14.1.1-7 baseline
Former-commit-id:4fff87723f
[formerly3328e2dd1d
[formerly 8add3b227e88c3943ea605fdc4e2f2b3c7dcf998]] Former-commit-id:3328e2dd1d
Former-commit-id:80614c0e52
This commit is contained in:
parent
f44bae4383
commit
21ff310620
334 changed files with 42692 additions and 38047 deletions
|
@ -37,14 +37,13 @@
|
|||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="org.eclipse.core.runtime"
|
||||
id="org.apache.commons.io"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
version="0.0.0"/>
|
||||
|
||||
<plugin
|
||||
id="org.eclipse.ui"
|
||||
id="org.apache.commons.compress"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
|
|
|
@ -8,6 +8,7 @@ Bundle-Vendor: RAYTHEON
|
|||
Require-Bundle: org.eclipse.ui;bundle-version="3.8.2",
|
||||
org.eclipse.core.runtime,
|
||||
org.apache.commons.lang;bundle-version="2.3.0",
|
||||
org.apache.commons.io;bundle-version="2.4.0",
|
||||
com.raytheon.viz.ui;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.serialization;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.localization;bundle-version="1.12.1174",
|
||||
|
@ -15,6 +16,9 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.8.2",
|
|||
com.raytheon.uf.common.time;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.util;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.viz.core;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.units;bundle-version="1.0.0"
|
||||
com.raytheon.uf.common.units;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.auth;bundle-version="1.12.1174"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Import-Package: org.apache.commons.compress.archivers,
|
||||
org.apache.commons.compress.archivers.tar
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/**
|
||||
* 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;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
|
@ -6,7 +25,15 @@ import org.eclipse.core.commands.ExecutionException;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.raytheon.uf.common.archive.request.ArchiveAdminAuthRequest;
|
||||
import com.raytheon.uf.common.auth.user.IUser;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.archive.ui.CaseCreationDlg;
|
||||
import com.raytheon.uf.viz.core.auth.UserController;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
|
||||
/**
|
||||
* Action to bring up the Archive Case Creation dialog..
|
||||
|
@ -18,6 +45,7 @@ import com.raytheon.uf.viz.archive.ui.CaseCreationDlg;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 16, 2013 1966 rferrel Initial creation
|
||||
* Oct 02, 2013 2326 rferrel Check for administration authorization.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -25,8 +53,14 @@ import com.raytheon.uf.viz.archive.ui.CaseCreationDlg;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class ArchiveCaseCreationDialogAction extends AbstractHandler {
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(ArchiveCaseCreationDialogAction.class);
|
||||
|
||||
private CaseCreationDlg dialog;
|
||||
|
||||
/** Case Administration permission */
|
||||
private final String PERMISSION = "archive.casecreation";
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -36,16 +70,44 @@ public class ArchiveCaseCreationDialogAction extends AbstractHandler {
|
|||
*/
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
if (dialog == null || dialog.isDisposed()) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
dialog = new CaseCreationDlg(shell);
|
||||
dialog.open();
|
||||
} else {
|
||||
dialog.bringToTop();
|
||||
if (isAuthorized()) {
|
||||
if (dialog == null || dialog.isDisposed()) {
|
||||
Shell shell = PlatformUI.getWorkbench()
|
||||
.getActiveWorkbenchWindow().getShell();
|
||||
dialog = new CaseCreationDlg(shell);
|
||||
dialog.open();
|
||||
} else {
|
||||
dialog.bringToTop();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is user authorized?
|
||||
*
|
||||
* @return true if authorized
|
||||
*/
|
||||
private boolean isAuthorized() {
|
||||
IUser user = UserController.getUserObject();
|
||||
String msg = user.uniqueId()
|
||||
+ " does not have permission to access archive case creation dialog.";
|
||||
ArchiveAdminAuthRequest request = new ArchiveAdminAuthRequest();
|
||||
request.setRoleId(PERMISSION);
|
||||
request.setNotAuthorizedMessage(msg);
|
||||
request.setUser(user);
|
||||
|
||||
try {
|
||||
Object o = ThriftClient.sendPrivilegedRequest(request);
|
||||
if (o instanceof ArchiveAdminAuthRequest) {
|
||||
ArchiveAdminAuthRequest r = (ArchiveAdminAuthRequest) o;
|
||||
return r.isAuthorized();
|
||||
}
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/**
|
||||
* 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;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
|
@ -6,7 +25,15 @@ import org.eclipse.core.commands.ExecutionException;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.raytheon.uf.common.archive.request.ArchiveAdminAuthRequest;
|
||||
import com.raytheon.uf.common.auth.user.IUser;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.archive.ui.ArchiveRetentionDlg;
|
||||
import com.raytheon.uf.viz.core.auth.UserController;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
|
||||
/**
|
||||
* Action to display the Archive Retention dialog.
|
||||
|
@ -18,6 +45,7 @@ import com.raytheon.uf.viz.archive.ui.ArchiveRetentionDlg;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 16, 2013 1966 rferrel Initial creation
|
||||
* Oct 02, 2013 2326 rferrel Check for administration authorization.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -25,8 +53,14 @@ import com.raytheon.uf.viz.archive.ui.ArchiveRetentionDlg;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class ArchiveRetentionDialogAction extends AbstractHandler {
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(ArchiveRetentionDialogAction.class);
|
||||
|
||||
private ArchiveRetentionDlg dialog;
|
||||
|
||||
/** Retention Administration permission */
|
||||
private final String PERMISSION = "archive.retention";
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -36,15 +70,44 @@ public class ArchiveRetentionDialogAction extends AbstractHandler {
|
|||
*/
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
if (dialog == null || dialog.isDisposed()) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
dialog = new ArchiveRetentionDlg(shell);
|
||||
dialog.open();
|
||||
} else {
|
||||
dialog.bringToTop();
|
||||
if (isAuthorized()) {
|
||||
if (dialog == null || dialog.isDisposed()) {
|
||||
Shell shell = PlatformUI.getWorkbench()
|
||||
.getActiveWorkbenchWindow().getShell();
|
||||
dialog = new ArchiveRetentionDlg(shell);
|
||||
dialog.open();
|
||||
} else {
|
||||
dialog.bringToTop();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is user authorized?
|
||||
*
|
||||
* @return true if authorized
|
||||
*/
|
||||
private boolean isAuthorized() {
|
||||
IUser user = UserController.getUserObject();
|
||||
String msg = user.uniqueId()
|
||||
+ " does not have permission to access archive retention dialog.";
|
||||
ArchiveAdminAuthRequest request = new ArchiveAdminAuthRequest();
|
||||
request.setRoleId(PERMISSION);
|
||||
request.setNotAuthorizedMessage(msg);
|
||||
request.setUser(user);
|
||||
|
||||
try {
|
||||
Object o = ThriftClient.sendPrivilegedRequest(request);
|
||||
if (o instanceof ArchiveAdminAuthRequest) {
|
||||
ArchiveAdminAuthRequest r = (ArchiveAdminAuthRequest) o;
|
||||
return r.isAuthorized();
|
||||
}
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.archive.data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* This class maintains the state of the archive selection so it can be restored
|
||||
|
@ -42,7 +42,7 @@ import java.util.Set;
|
|||
*/
|
||||
|
||||
public class ArchiveInfo {
|
||||
private final Map<String, CategoryInfo> categoryInfoMap = new HashMap<String, CategoryInfo>();
|
||||
private final Map<String, CategoryInfo> categoryInfoMap = new ConcurrentHashMap<String, CategoryInfo>();
|
||||
|
||||
public void add(CategoryInfo categoryInfo) {
|
||||
categoryInfoMap.put(categoryInfo.getCategoryName(), categoryInfo);
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.archive.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.archive.config.DisplayData;
|
||||
|
@ -34,6 +36,7 @@ import com.raytheon.uf.common.archive.config.DisplayData;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 24, 2013 1966 rferrel Initial creation
|
||||
* Aug 14, 2013 2220 rferrel Make sure displayDataList is never null.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -49,31 +52,57 @@ public class CategoryInfo {
|
|||
private final String categoryName;
|
||||
|
||||
/** List of display items for the category. */
|
||||
private final List<DisplayData> displayDataList;
|
||||
private List<DisplayData> displayDataList;
|
||||
|
||||
/**
|
||||
* Contructor.
|
||||
* Constructor.
|
||||
*
|
||||
* @param archiveName
|
||||
* @param categoryName
|
||||
* @param displayInfoList
|
||||
*/
|
||||
public CategoryInfo(String archiveName, String categoryName,
|
||||
List<DisplayData> displayInfoList) {
|
||||
List<DisplayData> displayDataList) {
|
||||
this.archiveName = archiveName;
|
||||
this.categoryName = categoryName;
|
||||
this.displayDataList = displayInfoList;
|
||||
if (displayDataList == null) {
|
||||
this.displayDataList = new ArrayList<DisplayData>(0);
|
||||
} else {
|
||||
setDisplayDataList(displayDataList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the display data list.
|
||||
*
|
||||
* @param displayDataList
|
||||
*/
|
||||
public void setDisplayDataList(List<DisplayData> displayDataList) {
|
||||
this.displayDataList = new ArrayList<DisplayData>(
|
||||
displayDataList.size());
|
||||
this.displayDataList.addAll(displayDataList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return archiveName
|
||||
*/
|
||||
public String getArchiveName() {
|
||||
return archiveName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return categoryName
|
||||
*/
|
||||
public String getCategoryName() {
|
||||
return categoryName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get unmodifiable display data list.
|
||||
*
|
||||
* @return displayDataList
|
||||
*/
|
||||
public List<DisplayData> getDisplayDataList() {
|
||||
return displayDataList;
|
||||
return Collections.unmodifiableList(displayDataList);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* Interface to adjusting values based on the retention hour value found in a
|
||||
* selection configuration.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 13, 2013 2220 rferrel Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author rferrel
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface IRetentionHour {
|
||||
/**
|
||||
* Adjust start/end based on the value found in selection configuration.
|
||||
*
|
||||
* @param startRetentionHours
|
||||
*/
|
||||
public void setRetentionTimes(long startRetentionHours);
|
||||
}
|
|
@ -21,6 +21,8 @@ package com.raytheon.uf.viz.archive.data;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.archive.config.DisplayData;
|
||||
|
||||
/**
|
||||
* A listener to update file/directory information.
|
||||
*
|
||||
|
@ -31,6 +33,7 @@ import java.util.List;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 16, 2013 1966 rferrel Initial creation
|
||||
* Jul 29, 2012 #2220 rferrel Change to get all data sizes only one time.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -43,5 +46,5 @@ public interface IUpdateListener {
|
|||
*
|
||||
* @param dirInfos
|
||||
*/
|
||||
public void update(List<SizeJobRequest> request);
|
||||
public void update(List<DisplayData> request);
|
||||
}
|
||||
|
|
|
@ -3,8 +3,18 @@ package com.raytheon.uf.viz.archive.data;
|
|||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.Map;
|
||||
import java.util.PriorityQueue;
|
||||
import java.util.Set;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.PriorityBlockingQueue;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
@ -13,8 +23,16 @@ 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.ArchiveConstants;
|
||||
import com.raytheon.uf.common.archive.config.ArchiveConstants.Type;
|
||||
import com.raytheon.uf.common.archive.config.DisplayData;
|
||||
import com.raytheon.uf.common.util.FileUtil;
|
||||
import com.raytheon.uf.common.archive.config.SelectConfig;
|
||||
import com.raytheon.uf.common.archive.config.select.ArchiveSelect;
|
||||
import com.raytheon.uf.common.archive.config.select.CategorySelect;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
|
||||
/**
|
||||
* Job to determine the size for a directory and its contents on a non-UI
|
||||
|
@ -27,6 +45,9 @@ import com.raytheon.uf.common.util.FileUtil;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 13, 2013 rferrel Initial creation
|
||||
* Jul 24, 2013 #2220 rferrel Change to get all data sizes only one time.
|
||||
* Aug 02, 2013 #2224 rferrel Changes for new configuration files.
|
||||
* Aug 06, 2013 #2222 rferrel Changes to display all selected data.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -34,26 +55,139 @@ import com.raytheon.uf.common.util.FileUtil;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class SizeJob extends Job {
|
||||
|
||||
/** The queue for requested sizes. */
|
||||
private final ConcurrentLinkedQueue<SizeJobRequest> queue = new ConcurrentLinkedQueue<SizeJobRequest>();
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(SizeJob.class);
|
||||
|
||||
/**
|
||||
* Pending selected entries that still need to have the sizes determined.
|
||||
* The private variable from PriorityQueue.
|
||||
*/
|
||||
private final ConcurrentLinkedQueue<DisplayData> selectedQueue = new ConcurrentLinkedQueue<DisplayData>();
|
||||
private final int DEFAULT_INITIAL_CAPACITY = 11;
|
||||
|
||||
/**
|
||||
* Indicates the job should stop computing the size of the current
|
||||
* non-selected entry.
|
||||
* Mapping of display data by archive and category names.
|
||||
*/
|
||||
private final AtomicBoolean stopComputeSize = new AtomicBoolean(false);
|
||||
private final Map<String, ArchiveInfo> archiveInfoMap = new ConcurrentHashMap<String, ArchiveInfo>();
|
||||
|
||||
/**
|
||||
* The listeners to inform when job is done with an entry.
|
||||
* Current archive name needing sizes.
|
||||
*/
|
||||
private String displayArchive;
|
||||
|
||||
/**
|
||||
* Current category name needing sizes.
|
||||
*/
|
||||
private String displayCategory;
|
||||
|
||||
/**
|
||||
* Set to true when all sizes are computed for the current display
|
||||
* archive/category list.
|
||||
*/
|
||||
private final AtomicBoolean displaySizesComputed = new AtomicBoolean(false);
|
||||
|
||||
/**
|
||||
* Queue of display data needing sizes.
|
||||
*/
|
||||
private final PriorityBlockingQueue<DisplayData> sizeQueue = new PriorityBlockingQueue<DisplayData>(
|
||||
DEFAULT_INITIAL_CAPACITY, DisplayData.PRIORITY_ORDER);
|
||||
|
||||
/**
|
||||
* Data to send to listeners.
|
||||
*/
|
||||
private final LinkedBlockingQueue<DisplayData> displayQueue = new LinkedBlockingQueue<DisplayData>();
|
||||
|
||||
/**
|
||||
* Current list of visible data.
|
||||
*/
|
||||
private List<DisplayData> visibleList = new ArrayList<DisplayData>(0);
|
||||
|
||||
/**
|
||||
* Set to true when running job should stop and never be rescheduled.
|
||||
*/
|
||||
private final AtomicBoolean shutdown = new AtomicBoolean(false);
|
||||
|
||||
/**
|
||||
* The listeners to inform when job is done with a request.
|
||||
*/
|
||||
private final List<IUpdateListener> listeners = new ArrayList<IUpdateListener>();
|
||||
|
||||
/**
|
||||
* The display data whose size is being computed.
|
||||
*/
|
||||
private DisplayData currentDisplayData;
|
||||
|
||||
/**
|
||||
* Method to call when loading a new selection for retention/case creation
|
||||
* to update times.
|
||||
*/
|
||||
private IRetentionHour iRetentionHour;
|
||||
|
||||
/**
|
||||
* Current start time.
|
||||
*/
|
||||
private Calendar startCal;
|
||||
|
||||
/**
|
||||
* Current end time.
|
||||
*/
|
||||
private Calendar endCal;
|
||||
|
||||
/**
|
||||
* Timer to periodically update the GUI display computed sizes.
|
||||
*/
|
||||
private Timer displayTimer;
|
||||
|
||||
/**
|
||||
* Flag to shutdown the display timer.
|
||||
*/
|
||||
private final AtomicBoolean shutdownDisplayTimer = new AtomicBoolean(false);
|
||||
|
||||
/**
|
||||
* Frequency for performing peek while computing sizes.
|
||||
*/
|
||||
private final int peekFrequency = 50;
|
||||
|
||||
/**
|
||||
* Counter to reduce the number of times a peek is performed while computing
|
||||
* sizes.
|
||||
*/
|
||||
private int peekCnt;
|
||||
|
||||
/**
|
||||
* Flag to stop computing sizes; only accessed by a single thread.
|
||||
*/
|
||||
private boolean stopComputeSize;
|
||||
|
||||
/**
|
||||
* Priority queue for getting display data for an archive/category.
|
||||
*/
|
||||
// Do not use a PriorityBlockingQueue since the load select and change
|
||||
// display methods need to be notified when the display data is available.
|
||||
private final PriorityQueue<MissingData> missingDataQueue = new PriorityQueue<SizeJob.MissingData>(
|
||||
DEFAULT_INITIAL_CAPACITY, new Comparator<MissingData>() {
|
||||
|
||||
@Override
|
||||
public int compare(MissingData o1, MissingData o2) {
|
||||
if (o1.visiable != o2.visiable) {
|
||||
return o1.visiable ? -1 : +1;
|
||||
}
|
||||
if (o1.isSelected() != o2.isSelected()) {
|
||||
return o1.isSelected() ? -1 : +1;
|
||||
}
|
||||
|
||||
int result = o1.archive.compareToIgnoreCase(o2.archive);
|
||||
|
||||
if (result == 0) {
|
||||
result = o1.category.compareToIgnoreCase(o2.category);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Job for processing the missing data queue.
|
||||
*/
|
||||
private final MissingDataJob missingDataJob = new MissingDataJob();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
|
@ -81,13 +215,39 @@ public class SizeJob extends Job {
|
|||
}
|
||||
|
||||
/**
|
||||
* Add entry to queue and if pending selected entries add them to the queue
|
||||
* with same start/end times.
|
||||
* Start and/or end time has changed so all sizes need to be recomputed.
|
||||
*
|
||||
* @param fileInfo
|
||||
* @param startCal
|
||||
* @param endCal
|
||||
*/
|
||||
public void queue(SizeJobRequest fileInfo) {
|
||||
queue.add(fileInfo);
|
||||
public void resetTime(Calendar startCal, Calendar endCal) {
|
||||
this.startCal = startCal;
|
||||
this.endCal = endCal;
|
||||
recomputeSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Force getting the sizes for all data in the archive Information map.
|
||||
*/
|
||||
public void recomputeSize() {
|
||||
clearQueue();
|
||||
for (ArchiveInfo archiveInfo : archiveInfoMap.values()) {
|
||||
for (String categoryName : archiveInfo.getCategoryNames()) {
|
||||
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
|
||||
for (DisplayData displayData : categoryInfo
|
||||
.getDisplayDataList()) {
|
||||
displayData.setSize(DisplayData.UNKNOWN_SIZE);
|
||||
sizeQueue.add(displayData);
|
||||
|
||||
if (shutdown.get()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Forces update of current display.
|
||||
displaySizesComputed.set(false);
|
||||
|
||||
if (getState() == Job.NONE) {
|
||||
schedule();
|
||||
|
@ -95,43 +255,384 @@ public class SizeJob extends Job {
|
|||
}
|
||||
|
||||
/**
|
||||
* Clear queue but save selected entries still needing sizes.
|
||||
* Add entry to the archive information map.
|
||||
*
|
||||
* @param archiveName
|
||||
* @param archiveInfo
|
||||
*/
|
||||
public void clearQueue() {
|
||||
List<SizeJobRequest> pending = new ArrayList<SizeJobRequest>();
|
||||
public void put(String archiveName, ArchiveInfo archiveInfo) {
|
||||
archiveInfoMap.put(archiveName, archiveInfo);
|
||||
}
|
||||
|
||||
// Drain queue queue.removeAll() doesn't work.
|
||||
while (!queue.isEmpty()) {
|
||||
pending.add(queue.remove());
|
||||
/**
|
||||
* Get an entry from the archive information map.
|
||||
*
|
||||
* @param archiveName
|
||||
* @return
|
||||
*/
|
||||
public ArchiveInfo get(String archiveName) {
|
||||
return archiveInfoMap.get(archiveName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return archiveNames
|
||||
*/
|
||||
public Set<String> getArchiveNames() {
|
||||
return archiveInfoMap.keySet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check all displayData selection state so only the data in selections are
|
||||
* set.
|
||||
*
|
||||
* @param selections
|
||||
*/
|
||||
public void loadSelect(String selectName, ArchiveConstants.Type type) {
|
||||
ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
|
||||
String fileName = ArchiveConstants.selectFileName(type, selectName);
|
||||
SelectConfig selections = manager.loadSelection(fileName);
|
||||
if (selections == null) {
|
||||
selections = new SelectConfig();
|
||||
selections.setName(ArchiveConstants.defaultSelectName);
|
||||
}
|
||||
iRetentionHour.setRetentionTimes(selections.getStarRetentionHours());
|
||||
|
||||
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);
|
||||
for (String archiveName : getArchiveNames()) {
|
||||
ArchiveInfo archiveInfo = get(archiveName);
|
||||
for (String categoryName : archiveInfo.getCategoryNames()) {
|
||||
List<String> selectionsList = selections.getSelectedList(
|
||||
archiveName, categoryName);
|
||||
MissingData missingData = removeMissingData(archiveName,
|
||||
categoryName);
|
||||
if (missingData != null) {
|
||||
missingData.setSelectedList(selectionsList);
|
||||
addMissingData(missingData);
|
||||
} else {
|
||||
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
|
||||
for (DisplayData displayData : categoryInfo
|
||||
.getDisplayDataList()) {
|
||||
String displayLabel = displayData.getDisplayLabel();
|
||||
boolean selected = selectionsList
|
||||
.contains(displayLabel);
|
||||
if (selected != displayData.isSelected()) {
|
||||
setSelect(displayData, selected);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Requeue pending entries.
|
||||
* Get list of all selected data.
|
||||
*
|
||||
* @param startCal
|
||||
* @param endCal
|
||||
* @return selected
|
||||
*/
|
||||
public void requeueSelected(Calendar startCal, Calendar endCal) {
|
||||
if (!selectedQueue.isEmpty()) {
|
||||
DisplayData displayData = selectedQueue.remove();
|
||||
queue(new SizeJobRequest(displayData, startCal, endCal));
|
||||
public List<DisplayData> getSelectAll() {
|
||||
synchronized (missingDataQueue) {
|
||||
while (!missingDataQueue.isEmpty()) {
|
||||
if (missingDataJob.currentMissingData == null
|
||||
|| missingDataJob.currentMissingData.isSelected()) {
|
||||
missingDataQueueWait();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
List<DisplayData> selected = new LinkedList<DisplayData>();
|
||||
for (ArchiveInfo archiveInfo : archiveInfoMap.values()) {
|
||||
for (String categoryName : archiveInfo.getCategoryNames()) {
|
||||
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
|
||||
for (DisplayData displayData : categoryInfo
|
||||
.getDisplayDataList()) {
|
||||
if (displayData.isSelected()) {
|
||||
selected.add(displayData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return selected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save selections to the desired file.
|
||||
*
|
||||
* @param selectName
|
||||
* @param type
|
||||
* @param startRetentionMS
|
||||
* @return
|
||||
*/
|
||||
public String saveSelect(String selectName, ArchiveConstants.Type type,
|
||||
long startRetentionMS) {
|
||||
String errorMsg = null;
|
||||
SelectConfig selections = new SelectConfig();
|
||||
selections.setName(selectName);
|
||||
if (type == Type.Case) {
|
||||
long startRetentionHours = startRetentionMS
|
||||
/ TimeUtil.MILLIS_PER_HOUR;
|
||||
selections.setStarRetentionHours(startRetentionHours);
|
||||
}
|
||||
for (String archiveName : getArchiveNames()) {
|
||||
ArchiveInfo archiveInfo = get(archiveName);
|
||||
ArchiveSelect archiveSelect = new ArchiveSelect();
|
||||
archiveSelect.setName(archiveName);
|
||||
for (String categoryName : archiveInfo.getCategoryNames()) {
|
||||
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
|
||||
CategorySelect categorySelect = new CategorySelect();
|
||||
categorySelect.setName(categoryName);
|
||||
for (DisplayData displayData : categoryInfo
|
||||
.getDisplayDataList()) {
|
||||
if (displayData.isSelected()) {
|
||||
categorySelect.add(displayData.getDisplayLabel());
|
||||
}
|
||||
}
|
||||
|
||||
if (!categorySelect.isEmpty()) {
|
||||
archiveSelect.add(categorySelect);
|
||||
}
|
||||
}
|
||||
if (!archiveSelect.isEmpty()) {
|
||||
selections.add(archiveSelect);
|
||||
}
|
||||
}
|
||||
String fileName = ArchiveConstants.selectFileName(type, selectName);
|
||||
|
||||
try {
|
||||
ArchiveConfigManager.getInstance().saveSelections(selections,
|
||||
fileName);
|
||||
} catch (Exception e) {
|
||||
errorMsg = "Unable to save file: " + fileName;
|
||||
statusHandler.handle(Priority.ERROR, errorMsg, e);
|
||||
}
|
||||
return errorMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the selection state and reset priority.
|
||||
*
|
||||
* @param displayData
|
||||
* @param state
|
||||
*/
|
||||
public void setSelect(DisplayData displayData, boolean state) {
|
||||
if (displayData.isSelected() != state) {
|
||||
if (sizeQueue.remove(displayData)) {
|
||||
displayData.setSelected(state);
|
||||
sizeQueue.add(displayData);
|
||||
} else {
|
||||
displayData.setSelected(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change visibility state and reset priority.
|
||||
*
|
||||
* @param displayData
|
||||
* @param state
|
||||
*/
|
||||
private void setVisible(DisplayData displayData, boolean state) {
|
||||
if (displayData.isVisible() != state) {
|
||||
if (sizeQueue.remove(displayData)) {
|
||||
displayData.setVisible(state);
|
||||
sizeQueue.add(displayData);
|
||||
} else {
|
||||
displayData.setVisible(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the archive/category display.
|
||||
*
|
||||
* @param archiveName
|
||||
* @param categoryName
|
||||
* @return displayData when display needs to change otherwise null
|
||||
*/
|
||||
public List<DisplayData> changeDisplay(String archiveName,
|
||||
String categoryName) {
|
||||
List<DisplayData> displayDatas = null;
|
||||
if (!archiveName.equals(displayArchive)
|
||||
|| !categoryName.equals(displayCategory)) {
|
||||
MissingData missingData = removeMissingData(archiveName,
|
||||
categoryName);
|
||||
if (missingData != null) {
|
||||
missingData.setVisiable(true);
|
||||
synchronized (missingDataQueue) {
|
||||
addMissingData(missingData);
|
||||
while (missingDataQueue.contains(missingData)) {
|
||||
missingDataQueueWait();
|
||||
}
|
||||
}
|
||||
}
|
||||
displayDatas = archiveInfoMap.get(archiveName).get(categoryName)
|
||||
.getDisplayDataList();
|
||||
displayArchive = archiveName;
|
||||
displayCategory = categoryName;
|
||||
changeDisplay(displayDatas);
|
||||
}
|
||||
return displayDatas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change to display all selected data..
|
||||
*
|
||||
* @return displayhData when display needs to change otherwise null.
|
||||
*/
|
||||
public List<DisplayData> changeDisplayAll() {
|
||||
List<DisplayData> selectedData = null;
|
||||
if (displayArchive != null) {
|
||||
displayArchive = null;
|
||||
displayCategory = null;
|
||||
selectedData = getSelectAll();
|
||||
changeDisplay(selectedData);
|
||||
}
|
||||
return selectedData;
|
||||
}
|
||||
|
||||
public String initData(ArchiveConstants.Type type, String selectName,
|
||||
String displayArchive, String displayCategory,
|
||||
IRetentionHour iRetentionHour) {
|
||||
this.iRetentionHour = iRetentionHour;
|
||||
ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
|
||||
String fileName = ArchiveConstants.selectFileName(type, selectName);
|
||||
SelectConfig selections = manager.loadSelection(fileName);
|
||||
if (selections == null) {
|
||||
selections = new SelectConfig();
|
||||
selections.setName(ArchiveConstants.defaultSelectName);
|
||||
}
|
||||
iRetentionHour.setRetentionTimes(selections.getStarRetentionHours());
|
||||
|
||||
missingDataQueue.clear();
|
||||
|
||||
visibleList = manager.getDisplayData(displayArchive, displayCategory,
|
||||
false);
|
||||
List<String> selectedList = selections.getSelectedList(displayArchive,
|
||||
displayCategory);
|
||||
for (DisplayData displayData : visibleList) {
|
||||
displayData.setSelected(selectedList.contains(displayData
|
||||
.getDisplayLabel()));
|
||||
}
|
||||
|
||||
for (String archiveName : manager.getArchiveDataNamesList()) {
|
||||
ArchiveInfo archiveInfo = new ArchiveInfo();
|
||||
String[] categoryNames = manager.getCategoryNames(manager
|
||||
.getArchive(archiveName));
|
||||
for (String categoryName : categoryNames) {
|
||||
CategoryInfo categoryInfo = new CategoryInfo(archiveName,
|
||||
categoryName, null);
|
||||
archiveInfo.add(categoryInfo);
|
||||
if (archiveName.equals(displayArchive)
|
||||
&& categoryName.equals(displayCategory)) {
|
||||
categoryInfo.setDisplayDataList(visibleList);
|
||||
if (!visibleList.isEmpty()) {
|
||||
schedule();
|
||||
}
|
||||
} else {
|
||||
selectedList = selections.getSelectedList(archiveName,
|
||||
categoryName);
|
||||
MissingData missingData = new MissingData(archiveName,
|
||||
categoryName, selectedList);
|
||||
missingDataQueue.add(missingData);
|
||||
}
|
||||
}
|
||||
put(archiveName, archiveInfo);
|
||||
}
|
||||
|
||||
missingDataJob.schedule();
|
||||
|
||||
return selections.getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Find and remove the missing data from the missing data queue.
|
||||
*
|
||||
* @param archiveName
|
||||
* @param categoryName
|
||||
* @return missingData or null if not on the missing data queue
|
||||
*/
|
||||
private MissingData removeMissingData(String archiveName,
|
||||
String categoryName) {
|
||||
MissingData missingData = null;
|
||||
synchronized (missingDataQueue) {
|
||||
if (missingDataJob.currentMissingData != null
|
||||
&& archiveName
|
||||
.equals(missingDataJob.currentMissingData.archive)
|
||||
&& categoryName
|
||||
.equals(missingDataJob.currentMissingData.category)) {
|
||||
// Finish the process of getting the data.
|
||||
missingDataQueueWait();
|
||||
} else if (!missingDataQueue.isEmpty()) {
|
||||
Iterator<MissingData> iterator = missingDataQueue.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
MissingData md = iterator.next();
|
||||
if (md.archive.equals(archiveName)
|
||||
&& md.category.equals(categoryName)) {
|
||||
iterator.remove();
|
||||
missingData = md;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return missingData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for notification that current missing data is finished processing.
|
||||
*
|
||||
* @return false when interrupted exception
|
||||
*/
|
||||
private boolean missingDataQueueWait() {
|
||||
boolean state = true;
|
||||
try {
|
||||
missingDataQueue.wait();
|
||||
} catch (InterruptedException e) {
|
||||
state = false;
|
||||
statusHandler.handle(Priority.INFO, e.getLocalizedMessage(), e);
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param missingData
|
||||
*/
|
||||
private void addMissingData(MissingData missingData) {
|
||||
synchronized (missingDataQueue) {
|
||||
missingDataQueue.add(missingData);
|
||||
if (missingDataJob.getState() == Job.NONE) {
|
||||
missingDataJob.schedule();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change update visible to the new list.
|
||||
*
|
||||
* @param newDisplays
|
||||
*/
|
||||
private void changeDisplay(List<DisplayData> newDisplays) {
|
||||
List<DisplayData> oldDisplays = visibleList;
|
||||
visibleList = newDisplays;
|
||||
List<DisplayData> visibleList = new ArrayList<DisplayData>(newDisplays);
|
||||
|
||||
for (DisplayData displayData : oldDisplays) {
|
||||
if (!visibleList.remove(displayData)) {
|
||||
setVisible(displayData, false);
|
||||
}
|
||||
}
|
||||
|
||||
for (DisplayData displayData : visibleList) {
|
||||
setVisible(displayData, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear request queues and stop current request.
|
||||
*/
|
||||
public void clearQueue() {
|
||||
sizeQueue.clear();
|
||||
displayQueue.clear();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -148,51 +649,123 @@ public class SizeJob extends Job {
|
|||
|
||||
ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
|
||||
|
||||
mainLoop: while (!queue.isEmpty()) {
|
||||
SizeJobRequest dirInfo = queue.remove();
|
||||
updateDisplayTimer();
|
||||
|
||||
stopComputeSize.set(false);
|
||||
DisplayData displayData = dirInfo.displayData;
|
||||
Calendar startCal = dirInfo.startCal;
|
||||
Calendar endCal = dirInfo.endCal;
|
||||
mainLoop: while (!shutdown.get()) {
|
||||
|
||||
List<File> files = manager.getDisplayFiles(displayData, startCal,
|
||||
endCal);
|
||||
|
||||
// Size no longer needed.
|
||||
if (!displayData.isSelected() && stopComputeSize.get()) {
|
||||
continue;
|
||||
currentDisplayData = sizeQueue.peek();
|
||||
if (currentDisplayData == null) {
|
||||
break mainLoop;
|
||||
}
|
||||
|
||||
// System.out.println("+++SizeJob: " + currentDisplayData);
|
||||
|
||||
List<File> files = manager.getDisplayFiles(currentDisplayData,
|
||||
startCal, endCal);
|
||||
|
||||
// Size no longer needed.
|
||||
if (currentDisplayData != sizeQueue.peek()) {
|
||||
// System.out.println("---SizeJob: " + currentDisplayData);
|
||||
continue mainLoop;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
peekCnt = peekFrequency;
|
||||
stopComputeSize = false;
|
||||
|
||||
for (File file : files) {
|
||||
if (file.isDirectory()) {
|
||||
size += FileUtil.sizeOfDirectory(file);
|
||||
size += sizeOfDirectory(file);
|
||||
} else {
|
||||
size += file.length();
|
||||
}
|
||||
|
||||
// Skip when size no longer needed.
|
||||
if (stopComputeSize) {
|
||||
// System.out.println("---SizeJob: " + currentDisplayData);
|
||||
continue mainLoop;
|
||||
}
|
||||
}
|
||||
|
||||
displayData.setSize(size);
|
||||
|
||||
List<SizeJobRequest> list = new ArrayList<SizeJobRequest>(1);
|
||||
list.add(dirInfo);
|
||||
for (IUpdateListener listener : listeners) {
|
||||
listener.update(list);
|
||||
}
|
||||
sizeQueue.remove(currentDisplayData);
|
||||
currentDisplayData.setSize(size);
|
||||
displayQueue.add(currentDisplayData);
|
||||
}
|
||||
|
||||
// System.out.println("xxxSizeJob: OK_STATUS");
|
||||
shutdownDisplayTimer.set(true);
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the total size of a directory; unless stop flag is set then
|
||||
* result is unknown.
|
||||
*
|
||||
* @param directory
|
||||
* @return size
|
||||
*/
|
||||
private long sizeOfDirectory(File directory) {
|
||||
long size = 0;
|
||||
for (File file : directory.listFiles()) {
|
||||
if (stopComputeSize) {
|
||||
break;
|
||||
}
|
||||
if (--peekCnt == 0) {
|
||||
if (currentDisplayData != sizeQueue.peek()) {
|
||||
// Forces break out of recursion.
|
||||
stopComputeSize = true;
|
||||
break;
|
||||
}
|
||||
peekCnt = peekFrequency;
|
||||
}
|
||||
|
||||
if (file.isDirectory()) {
|
||||
size += sizeOfDirectory(file);
|
||||
} else {
|
||||
size += file.length();
|
||||
}
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start timer to update GUI's display form data on the display Queue.
|
||||
*/
|
||||
private void updateDisplayTimer() {
|
||||
if (displayTimer != null) {
|
||||
displayTimer.cancel();
|
||||
}
|
||||
|
||||
shutdownDisplayTimer.set(false);
|
||||
|
||||
displayTimer = new Timer();
|
||||
|
||||
TimerTask updateDisplayTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!displayQueue.isEmpty()) {
|
||||
List<DisplayData> list = new ArrayList<DisplayData>(
|
||||
displayQueue.size());
|
||||
displayQueue.drainTo(list);
|
||||
|
||||
// for (DisplayData displayData : list) {
|
||||
// System.out.println("== " + displayData);
|
||||
// }
|
||||
//
|
||||
for (IUpdateListener listener : listeners) {
|
||||
listener.update(list);
|
||||
}
|
||||
} else if (shutdownDisplayTimer.get()) {
|
||||
// System.out.println("xxx updateDisplayTimer canceled");
|
||||
displayTimer.cancel();
|
||||
displayTimer = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
displayTimer.schedule(updateDisplayTask, 1000, 2000);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -200,7 +773,125 @@ public class SizeJob extends Job {
|
|||
*/
|
||||
@Override
|
||||
protected void canceling() {
|
||||
queue.clear();
|
||||
stopComputeSize.set(true);
|
||||
// System.err.println("canceling SizeJob");
|
||||
clearQueue();
|
||||
missingDataQueue.clear();
|
||||
missingDataJob.cancel();
|
||||
shutdown.set(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Class used by the missing data job to obtain display data for given
|
||||
* archive/category off the UI thread.
|
||||
*/
|
||||
private static class MissingData {
|
||||
protected final String archive;
|
||||
|
||||
protected final String category;
|
||||
|
||||
protected final List<String> selectedList;
|
||||
|
||||
protected boolean visiable = false;
|
||||
|
||||
public MissingData(String archive, String category,
|
||||
List<String> selectedList) {
|
||||
this.archive = archive;
|
||||
this.category = category;
|
||||
this.selectedList = new ArrayList<String>(selectedList);
|
||||
}
|
||||
|
||||
public boolean isSelected() {
|
||||
return !selectedList.isEmpty();
|
||||
}
|
||||
|
||||
public void setVisiable(boolean state) {
|
||||
this.visiable = state;
|
||||
}
|
||||
|
||||
public void setSelectedList(List<String> selectedList) {
|
||||
this.selectedList.clear();
|
||||
this.selectedList.addAll(selectedList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("MissingData[");
|
||||
sb.append("archive: ").append(archive);
|
||||
sb.append(", category: ").append(category);
|
||||
sb.append(", visible: ").append(visiable);
|
||||
sb.append(", isSelected: ").append(isSelected());
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This handles getting the display data in the missing data queue and
|
||||
* queuing the results for the size job.
|
||||
*/
|
||||
private class MissingDataJob extends Job {
|
||||
|
||||
private final AtomicBoolean shutdown = new AtomicBoolean(false);
|
||||
|
||||
protected MissingData currentMissingData = null;
|
||||
|
||||
public MissingDataJob() {
|
||||
super("MissingData");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
if (monitor.isCanceled()) {
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
|
||||
ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
|
||||
|
||||
while (!shutdown.get()) {
|
||||
synchronized (missingDataQueue) {
|
||||
if (currentMissingData != null) {
|
||||
missingDataQueue.notifyAll();
|
||||
}
|
||||
currentMissingData = missingDataQueue.poll();
|
||||
}
|
||||
|
||||
if (currentMissingData == null) {
|
||||
break;
|
||||
}
|
||||
|
||||
String archiveName = currentMissingData.archive;
|
||||
String categoryName = currentMissingData.category;
|
||||
// System.out.println("== missingData: " + currentMissingData);
|
||||
List<String> selectedList = currentMissingData.selectedList;
|
||||
List<DisplayData> displayDatas = manager.getDisplayData(
|
||||
archiveName, categoryName, false);
|
||||
if (shutdown.get()) {
|
||||
break;
|
||||
}
|
||||
|
||||
for (DisplayData displayData : displayDatas) {
|
||||
displayData.setSelected(selectedList.contains(displayData
|
||||
.getDisplayLabel()));
|
||||
sizeQueue.add(displayData);
|
||||
}
|
||||
|
||||
archiveInfoMap.get(archiveName).get(categoryName)
|
||||
.setDisplayDataList(displayDatas);
|
||||
|
||||
if (SizeJob.this.getState() == Job.NONE) {
|
||||
SizeJob.this.schedule();
|
||||
}
|
||||
}
|
||||
|
||||
// System.out.println("xxx missingData");
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void canceling() {
|
||||
// System.err.println("canceling MissingDataJob");
|
||||
shutdown.set(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -21,37 +21,37 @@ package com.raytheon.uf.viz.archive.ui;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
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.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.ShellAdapter;
|
||||
import org.eclipse.swt.events.ShellEvent;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.MessageBox;
|
||||
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.ArchiveConstants;
|
||||
import com.raytheon.uf.common.archive.config.CategoryConfig;
|
||||
import com.raytheon.uf.common.archive.config.DisplayData;
|
||||
import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException;
|
||||
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.IArchiveTotals;
|
||||
import com.raytheon.uf.viz.archive.data.IRetentionHour;
|
||||
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;
|
||||
|
||||
|
@ -68,7 +68,9 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* May 30, 2013 1965 bgonzale Initial creation
|
||||
* Jun 10, 2013 1966 rferrel Change to allow Case Creation to extend.
|
||||
*
|
||||
* Jul 24, 2013 2220 rferrel Changes to queue size request for all data.
|
||||
* Aug 01, 2013 2221 rferrel Changes for select configuration.
|
||||
* Aug 06, 2013 2222 rferrel Changes to display all selected data.
|
||||
* </pre>
|
||||
*
|
||||
* @author bgonzale
|
||||
|
@ -76,7 +78,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
*/
|
||||
|
||||
public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
||||
IArchiveTotals, IUpdateListener {
|
||||
IArchiveTotals, IUpdateListener, IModifyListener, IRetentionHour {
|
||||
|
||||
/** Table composite that holds the table controls. */
|
||||
private ArchiveTableComp tableComp;
|
||||
|
@ -87,8 +89,8 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
|||
/** Category combo box. */
|
||||
private Combo categoryCbo;
|
||||
|
||||
/** Information for populating the various table displays. */
|
||||
protected final Map<String, ArchiveInfo> archiveInfoMap = new HashMap<String, ArchiveInfo>();
|
||||
/** Data manager. */
|
||||
protected ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
|
||||
|
||||
/**
|
||||
* Boolean to indicate when DisplayData is created should its selection be
|
||||
|
@ -99,7 +101,7 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
|||
/**
|
||||
* Must be set by sub-class prior to creating table.
|
||||
*/
|
||||
protected TableType tableType;
|
||||
protected ArchiveConstants.Type type;
|
||||
|
||||
/**
|
||||
* Job that computes sizes of table row entries off the UI thread.
|
||||
|
@ -109,6 +111,21 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
|||
/** Keeps track of when it is safe to clear the busy cursor. */
|
||||
protected final AtomicInteger busyCnt = new AtomicInteger(0);
|
||||
|
||||
/** Performs save action button. */
|
||||
protected Button saveBtn;
|
||||
|
||||
/** Optional button to toggle displaying all selected or category */
|
||||
protected Button showSelectedBtn;
|
||||
|
||||
/** Flag set when user wants to close with unsaved modifications. */
|
||||
protected boolean closeFlag = false;
|
||||
|
||||
/** Current select (case/retention) loaded into the dialog. */
|
||||
protected String selectName = ArchiveConstants.defaultSelectName;
|
||||
|
||||
/** Which table is being displayed. */
|
||||
private boolean showingSelected = true;
|
||||
|
||||
/**
|
||||
* @param parentShell
|
||||
*/
|
||||
|
@ -133,23 +150,6 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
|||
super(parentShell, style, caveStyle);
|
||||
}
|
||||
|
||||
public List<DisplayData> getAllSelected() {
|
||||
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
|
||||
.getDisplayDataList()) {
|
||||
if (displayData.isSelected()) {
|
||||
allSelected.add(displayData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return allSelected;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name of the currently selected archive in the dialog; null if
|
||||
* none found
|
||||
|
@ -203,6 +203,11 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
|||
*/
|
||||
protected abstract void setTotalSizeText(String sizeStringText);
|
||||
|
||||
/**
|
||||
* This method is called by the AbstractArchiveDlg to set total Size.
|
||||
*
|
||||
* @param totalSize
|
||||
*/
|
||||
protected abstract void setTotalSelectedItems(int totalSize);
|
||||
|
||||
/**
|
||||
|
@ -265,6 +270,18 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
|||
return comboComp;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
|
||||
* .eclipse.swt.widgets.Shell)
|
||||
*/
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
ArchiveConfigManager.getInstance().reset();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -274,42 +291,55 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
|||
protected void preOpened() {
|
||||
super.preOpened();
|
||||
setCursorBusy(true);
|
||||
populateComboBoxes();
|
||||
String titleName = initDisplayData();
|
||||
setSelectName(titleName);
|
||||
populateTableComp();
|
||||
setCursorBusy(false);
|
||||
|
||||
addModifiedListener(this);
|
||||
shell.addShellListener(new ShellAdapter() {
|
||||
|
||||
// Setup to display blank dialog with busy cursor while getting data.
|
||||
Job job = new Job("setup") {
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
if (!shell.isDisposed()) {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
populateComboBoxes();
|
||||
setCursorBusy(false);
|
||||
}
|
||||
});
|
||||
public void shellClosed(ShellEvent e) {
|
||||
if (closeFlag || !isModified()) {
|
||||
return;
|
||||
}
|
||||
initDisplayData();
|
||||
if (!shell.isDisposed()) {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
updateTableComp();
|
||||
e.doit = false;
|
||||
VizApp.runAsync(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (verifyClose()) {
|
||||
close();
|
||||
}
|
||||
});
|
||||
}
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
job.schedule();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the select name and update the dialog's title. Assumes the
|
||||
* sub-classes places a hyphen at the end of the string when setting the
|
||||
* dialog's title.
|
||||
*
|
||||
* @param selectName
|
||||
*/
|
||||
protected void setSelectName(String selectName) {
|
||||
this.selectName = selectName;
|
||||
StringBuilder sb = new StringBuilder(getText());
|
||||
sb.setLength(sb.indexOf("-") + 1);
|
||||
sb.append(" ").append(selectName);
|
||||
setText(sb.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the table control.
|
||||
*/
|
||||
protected void createTable() {
|
||||
tableComp = new ArchiveTableComp(shell, tableType, this);
|
||||
tableComp = new ArchiveTableComp(shell, type, this, sizeJob);
|
||||
sizeJob.addUpdateListener(this);
|
||||
}
|
||||
|
||||
|
@ -335,7 +365,6 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
|||
* Initial population up of the combo boxes.
|
||||
*/
|
||||
private void populateComboBoxes() {
|
||||
ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
|
||||
boolean doSelect = false;
|
||||
for (String archiveName : manager.getArchiveDataNamesList()) {
|
||||
archCfgCbo.add(archiveName);
|
||||
|
@ -344,7 +373,7 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
|||
|
||||
if (doSelect) {
|
||||
archCfgCbo.select(0);
|
||||
archiveComboSelection();
|
||||
initCategoryCbo();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -358,10 +387,13 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
|||
/**
|
||||
* Populate the category combo based on the archive name and populate the
|
||||
* table.
|
||||
*
|
||||
* @param archiveName
|
||||
*/
|
||||
private void populateCategoryCbo() {
|
||||
initCategoryCbo();
|
||||
categoryComboSelection();
|
||||
}
|
||||
|
||||
private void initCategoryCbo() {
|
||||
String archiveName = getSelectedArchiveName();
|
||||
ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
|
||||
categoryCbo.removeAll();
|
||||
|
@ -369,7 +401,6 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
|||
categoryCbo.add(categoryName);
|
||||
}
|
||||
categoryCbo.select(0);
|
||||
categoryComboSelection();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -383,32 +414,39 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
|||
* Set up all display data and queue getting sizes for any that are
|
||||
* selected.
|
||||
*/
|
||||
private void initDisplayData() {
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
protected String initDisplayData() {
|
||||
String displayArchive = getSelectedArchiveName();
|
||||
String displayCategory = getSelectedCategoryName();
|
||||
String selectedName = sizeJob.initData(type, null, displayArchive,
|
||||
displayCategory, this);
|
||||
sizeJob.resetTime(getStart(), getEnd());
|
||||
return selectedName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a select configuration file.
|
||||
*
|
||||
* @param selectName
|
||||
*/
|
||||
protected void deleteSelect(String selectName) {
|
||||
String fileName = ArchiveConstants.selectFileName(type, selectName);
|
||||
try {
|
||||
manager.deleteSelection(fileName);
|
||||
} catch (LocalizationOpFailedException e) {
|
||||
MessageDialog.openError(shell, "Case Error",
|
||||
"Unable to delete file: " + fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a select configuration file.
|
||||
*
|
||||
* @param selectName
|
||||
*/
|
||||
protected void loadSelect(String selectName) {
|
||||
sizeJob.loadSelect(selectName, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate the table based on the currently selected archive, category and
|
||||
* adjust sizes on the display table.
|
||||
|
@ -416,33 +454,20 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
|||
protected void populateTableComp() {
|
||||
String archiveName = getSelectedArchiveName();
|
||||
String categoryName = getSelectedCategoryName();
|
||||
Calendar startCal = getStart();
|
||||
Calendar endCal = getEnd();
|
||||
|
||||
setCursorBusy(true);
|
||||
|
||||
try {
|
||||
sizeJob.clearQueue();
|
||||
setShowingSelected(false);
|
||||
|
||||
ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName);
|
||||
|
||||
// Not yet populated by background job.
|
||||
if (archiveInfo == null) {
|
||||
return;
|
||||
List<DisplayData> displayDatas = sizeJob.changeDisplay(archiveName,
|
||||
categoryName);
|
||||
if (displayDatas != null) {
|
||||
tableComp
|
||||
.populateTable(archiveName, categoryName, displayDatas);
|
||||
} else {
|
||||
tableComp.refresh();
|
||||
}
|
||||
|
||||
// Not yet populated by background job.
|
||||
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
|
||||
if (categoryInfo == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (DisplayData displayData : categoryInfo.getDisplayDataList()) {
|
||||
sizeJob.queue(new SizeJobRequest(displayData, startCal, endCal));
|
||||
}
|
||||
sizeJob.requeueSelected(startCal, endCal);
|
||||
|
||||
tableComp.populateTable(categoryInfo.getDisplayDataList());
|
||||
} finally {
|
||||
setCursorBusy(false);
|
||||
}
|
||||
|
@ -474,8 +499,8 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
|||
long totalSize = 0;
|
||||
int totalSelected = 0;
|
||||
|
||||
for (String archiveName : archiveInfoMap.keySet()) {
|
||||
ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName);
|
||||
for (String archiveName : sizeJob.getArchiveNames()) {
|
||||
ArchiveInfo archiveInfo = sizeJob.get(archiveName);
|
||||
for (String categoryName : archiveInfo.getCategoryNames()) {
|
||||
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
|
||||
for (DisplayData displayData : categoryInfo
|
||||
|
@ -506,6 +531,75 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
|||
setTotalSelectedItems(totalSelected);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the showSelectedBtn for sub-classes.
|
||||
*
|
||||
* @param actionControlComp
|
||||
*/
|
||||
protected void createShowingSelectedBtn(Composite actionControlComp) {
|
||||
showSelectedBtn = new Button(actionControlComp, SWT.PUSH);
|
||||
setShowingSelected(false);
|
||||
showSelectedBtn.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
handelShowSelectAll();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate the table with the desired display.
|
||||
*/
|
||||
protected void handelShowSelectAll() {
|
||||
if (showingSelected) {
|
||||
populateTableComp();
|
||||
} else {
|
||||
populateSelectAllTable();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the state for the showing selected flag and updates the label for
|
||||
* the show selected button.
|
||||
*
|
||||
* @param state
|
||||
*/
|
||||
private void setShowingSelected(boolean state) {
|
||||
if (showSelectedBtn != null && !showSelectedBtn.isDisposed()) {
|
||||
if (showingSelected != state) {
|
||||
showingSelected = state;
|
||||
if (showingSelected) {
|
||||
showSelectedBtn.setText(" Category ");
|
||||
showSelectedBtn
|
||||
.setToolTipText("Change display to show category.");
|
||||
} else {
|
||||
showSelectedBtn.setText(" Selected ");
|
||||
showSelectedBtn
|
||||
.setToolTipText("Change display to show all case selections");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Up date the table to display all selected data.
|
||||
*/
|
||||
private void populateSelectAllTable() {
|
||||
setCursorBusy(true);
|
||||
|
||||
try {
|
||||
setShowingSelected(true);
|
||||
List<DisplayData> selectedData = sizeJob.changeDisplayAll();
|
||||
|
||||
if (selectedData != null) {
|
||||
tableComp.populateSelectAll(selectedData);
|
||||
}
|
||||
} finally {
|
||||
setCursorBusy(false);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -513,18 +607,26 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
|||
* 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());
|
||||
public void update(final List<DisplayData> displayDatas) {
|
||||
final List<DisplayData> myDisplayDatas = new ArrayList<DisplayData>(
|
||||
displayDatas.size());
|
||||
for (DisplayData data : displayDatas) {
|
||||
String label = data.getDisplayLabel();
|
||||
for (DisplayData displayData : sizeJob.get(data.getArchiveName())
|
||||
.get(data.getCategoryName()).getDisplayDataList()) {
|
||||
if (label.equals(displayData.getDisplayLabel())) {
|
||||
displayData.setSize(data.getSize());
|
||||
myDisplayDatas.add(displayData);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VizApp.runAsync(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
tableComp.updateSize(displayDatas);
|
||||
tableComp.updateSize(myDisplayDatas);
|
||||
updateTotals(null);
|
||||
}
|
||||
});
|
||||
|
@ -546,6 +648,16 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
|||
tableComp.addModifiedListener(iModifyListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the data information on all selected items; not just the currently
|
||||
* displayed table.
|
||||
*
|
||||
* @return selectedDatas
|
||||
*/
|
||||
protected List<DisplayData> getSelectedData() {
|
||||
return sizeJob.getSelectAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove modification listener.
|
||||
*
|
||||
|
@ -555,15 +667,70 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
|||
tableComp.removeModifiedListener(iModifyListener);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
|
||||
* .eclipse.swt.widgets.Shell)
|
||||
/**
|
||||
* Reset all data to unknown size, and queue request for sizes.
|
||||
*/
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
ArchiveConfigManager.getInstance().reset();
|
||||
protected void resetSizes() {
|
||||
sizeJob.recomputeSize();
|
||||
populateTableComp();
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows a sub-class to set the start and end times based on the off set.
|
||||
*
|
||||
* @param startTimeOffset
|
||||
*/
|
||||
public void setRetentionTimes(long startTimeOffset) {
|
||||
// do nothing override by sub-classes
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate unsaved user changes.
|
||||
*
|
||||
* @return modified
|
||||
*/
|
||||
protected boolean isModified() {
|
||||
return (saveBtn != null) && !saveBtn.isDisposed()
|
||||
&& saveBtn.isEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save current selections of the select configuration file.
|
||||
*
|
||||
* @param selectName
|
||||
* @return true when save is successful
|
||||
*/
|
||||
protected boolean saveSelection(String selectName) {
|
||||
Calendar start = getStart();
|
||||
Calendar end = getEnd();
|
||||
long startRetentionMS = 0L;
|
||||
if (start != null && end != null) {
|
||||
startRetentionMS = end.getTimeInMillis() - start.getTimeInMillis();
|
||||
}
|
||||
String errorMsg = sizeJob
|
||||
.saveSelect(selectName, type, startRetentionMS);
|
||||
if (errorMsg != null) {
|
||||
MessageDialog.openError(shell, type + " Selection Error", errorMsg);
|
||||
}
|
||||
|
||||
return errorMsg == null;
|
||||
}
|
||||
|
||||
/**
|
||||
* When unsaved modifications this asks the user to verify the close.
|
||||
*
|
||||
* @return true when okay to close.
|
||||
*/
|
||||
protected boolean verifyClose() {
|
||||
boolean state = true;
|
||||
if (isModified()) {
|
||||
MessageBox box = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK
|
||||
| SWT.CANCEL);
|
||||
box.setText("Close " + type);
|
||||
box.setMessage("Unsave changes.\nSelect OK to discard changes.");
|
||||
state = box.open() == SWT.OK;
|
||||
}
|
||||
closeFlag = state;
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,8 +25,6 @@ import java.util.List;
|
|||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.ShellAdapter;
|
||||
import org.eclipse.swt.events.ShellEvent;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
|
@ -34,15 +32,12 @@ import org.eclipse.swt.widgets.Combo;
|
|||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Layout;
|
||||
import org.eclipse.swt.widgets.MessageBox;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Spinner;
|
||||
|
||||
import com.raytheon.uf.common.archive.config.ArchiveConfigManager;
|
||||
import com.raytheon.uf.common.archive.config.ArchiveConstants.Type;
|
||||
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;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
|
||||
/**
|
||||
* Archive retention dialog.
|
||||
|
@ -56,14 +51,18 @@ import com.raytheon.uf.viz.core.VizApp;
|
|||
* 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.
|
||||
* Jul 24, 2013 #2220 rferrel Add recompute size button.
|
||||
* Jul 24, 2013 #2221 rferrel Changes for select configuration.
|
||||
* Aug 26, 2013 #2225 rferrel Make dialog perspective independent.
|
||||
* Oct 01, 2013 #2147 rferrel Change getEnd() to pick up files with future time stamps.
|
||||
* Oct 07, 2013 #2438 rferrel Properly save and load retention times.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
* @version 1.0
|
||||
*/
|
||||
public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
|
||||
IArchiveTotals, IModifyListener {
|
||||
public class ArchiveRetentionDlg extends AbstractArchiveDlg {
|
||||
|
||||
/** Current Archive/Category selection's minimum retention hours. */
|
||||
private RetentionHours minRetention;
|
||||
|
@ -77,11 +76,18 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
|
|||
/** Displays the total size of selected items. */
|
||||
private Label totalSizeLbl;
|
||||
|
||||
/** Performs save action button. */
|
||||
private Button saveBtn;
|
||||
/** Flag to indicate when retention hours are modified. */
|
||||
private boolean retentionHoursAreModified = false;
|
||||
|
||||
/** Flag set when user wants to close with unsaved modifications. */
|
||||
boolean closeFlag = false;
|
||||
/** Modification listener for the retention hours components. */
|
||||
private final IModifyListener retentionHoursModifyListener = new IModifyListener() {
|
||||
|
||||
@Override
|
||||
public void modified() {
|
||||
saveBtn.setEnabled(true);
|
||||
retentionHoursAreModified = true;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -91,9 +97,9 @@ 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;
|
||||
| CAVE.MODE_INDEPENDENT | CAVE.INDEPENDENT_SHELL
|
||||
| CAVE.PERSPECTIVE_INDEPENDENT);
|
||||
this.type = Type.Retention;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -120,7 +126,7 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
|
|||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
super.initializeComponents(shell);
|
||||
setText("Archive Retention");
|
||||
setText("Archive Retention -");
|
||||
Composite mainComp = new Composite(shell, SWT.NONE);
|
||||
GridLayout gl = new GridLayout(1, false);
|
||||
gl.marginHeight = 0;
|
||||
|
@ -186,7 +192,7 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
|
|||
return state;
|
||||
}
|
||||
};
|
||||
minRetention.addModifyListener(this);
|
||||
minRetention.addModifyListener(retentionHoursModifyListener);
|
||||
|
||||
/*
|
||||
* Bottom row of controls.
|
||||
|
@ -216,7 +222,7 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
|
|||
return state;
|
||||
}
|
||||
};
|
||||
extRetention.addModifyListener(this);
|
||||
extRetention.addModifyListener(retentionHoursModifyListener);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -225,37 +231,31 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
|
|||
private void createBottomActionButtons() {
|
||||
|
||||
Composite actionControlComp = new Composite(shell, SWT.NONE);
|
||||
GridLayout gl = new GridLayout(2, false);
|
||||
GridLayout gl = new GridLayout(3, false);
|
||||
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
actionControlComp.setLayout(gl);
|
||||
actionControlComp.setLayoutData(gd);
|
||||
|
||||
// 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
|
||||
// }
|
||||
// });
|
||||
|
||||
saveBtn = new Button(actionControlComp, SWT.PUSH);
|
||||
saveBtn.setText(" Save ");
|
||||
saveBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent selectionEvent) {
|
||||
ArchiveConfigManager manager = ArchiveConfigManager
|
||||
.getInstance();
|
||||
manager.save();
|
||||
saveBtn.setEnabled(false);
|
||||
clearModified();
|
||||
saveAction();
|
||||
}
|
||||
});
|
||||
saveBtn.setEnabled(false);
|
||||
|
||||
Button sizeBtn = new Button(actionControlComp, SWT.PUSH);
|
||||
sizeBtn.setText(" Recompute Sizes ");
|
||||
sizeBtn.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
resetSizes();
|
||||
}
|
||||
});
|
||||
|
||||
gd = new GridData(SWT.RIGHT, SWT.DEFAULT, true, false);
|
||||
Button closeBtn = new Button(actionControlComp, SWT.PUSH);
|
||||
closeBtn.setText(" Close ");
|
||||
|
@ -273,21 +273,15 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
|
|||
}
|
||||
|
||||
/**
|
||||
* When unsaved modifications this asks the user to verify the close.
|
||||
*
|
||||
* @return true when okay to close.
|
||||
* Save button action.
|
||||
*/
|
||||
private boolean verifyClose() {
|
||||
boolean state = true;
|
||||
if (isModified()) {
|
||||
MessageBox box = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK
|
||||
| SWT.CANCEL);
|
||||
box.setText("Close Retention");
|
||||
box.setMessage("Unsave changes.\nSelect OK to continue.");
|
||||
state = box.open() == SWT.OK;
|
||||
private void saveAction() {
|
||||
saveSelection(selectName);
|
||||
saveBtn.setEnabled(false);
|
||||
if (retentionHoursAreModified) {
|
||||
manager.save();
|
||||
}
|
||||
closeFlag = state;
|
||||
return state;
|
||||
clearModified();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -337,7 +331,10 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
|
|||
@Override
|
||||
protected Calendar getEnd() {
|
||||
// display all elements so no end bound
|
||||
return null;
|
||||
Calendar endCal = TimeUtil.newCalendar();
|
||||
// Back off an hour so latter rounding doesn't cause overflow.
|
||||
endCal.setTimeInMillis(Long.MAX_VALUE - TimeUtil.MILLIS_PER_HOUR);
|
||||
return endCal;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -402,6 +399,20 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
|
|||
super.clearModified();
|
||||
minRetention.clearModified();
|
||||
extRetention.clearModified();
|
||||
retentionHoursAreModified = false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#disposed()
|
||||
*/
|
||||
@Override
|
||||
protected void disposed() {
|
||||
minRetention.removeModifyListener(retentionHoursModifyListener);
|
||||
extRetention.removeModifyListener(retentionHoursModifyListener);
|
||||
removeModifiedListener(this);
|
||||
super.disposed();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -412,49 +423,7 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
|
|||
@Override
|
||||
protected void preOpened() {
|
||||
super.preOpened();
|
||||
addModifiedListener(this);
|
||||
shell.addShellListener(new ShellAdapter() {
|
||||
|
||||
@Override
|
||||
public void shellClosed(ShellEvent e) {
|
||||
if (closeFlag || !isModified()) {
|
||||
return;
|
||||
}
|
||||
|
||||
e.doit = false;
|
||||
VizApp.runAsync(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (verifyClose()) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#disposed()
|
||||
*/
|
||||
@Override
|
||||
protected void disposed() {
|
||||
minRetention.removeModifyListener(this);
|
||||
extRetention.removeModifyListener(this);
|
||||
removeModifiedListener(this);
|
||||
super.disposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate unsaved user changes.
|
||||
*
|
||||
* @return modified
|
||||
*/
|
||||
private boolean isModified() {
|
||||
return (saveBtn != null) && !saveBtn.isDisposed()
|
||||
&& saveBtn.isEnabled();
|
||||
archiveComboSelection();
|
||||
categoryComboSelection();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,9 +42,12 @@ 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.ArchiveConstants;
|
||||
import com.raytheon.uf.common.archive.config.ArchiveConstants.Type;
|
||||
import com.raytheon.uf.common.archive.config.DisplayData;
|
||||
import com.raytheon.uf.common.util.SizeUtil;
|
||||
import com.raytheon.uf.viz.archive.data.IArchiveTotals;
|
||||
import com.raytheon.uf.viz.archive.data.SizeJob;
|
||||
|
||||
/**
|
||||
* Archive table composite that contains the SWT table.
|
||||
|
@ -56,6 +59,10 @@ import com.raytheon.uf.viz.archive.data.IArchiveTotals;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 23, 2013 #1964 lvenable Initial creation
|
||||
* Jul 24, 2013 #2221 rferrel Changes for select configuration.
|
||||
* Aug 06, 2013 #2222 rferrel Changes to display all selected data.
|
||||
* Aug 14, 2013 #2220 rferrel Add refresh method.
|
||||
* Aug 26, 2013 #2225 rferrel Add missing updates.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -70,6 +77,14 @@ public class ArchiveTableComp extends Composite {
|
|||
/** Column to display size information,. */
|
||||
private final int SIZE_COL_INDEX = 1;
|
||||
|
||||
private boolean showSelectAll = false;
|
||||
|
||||
/** Name of table's archive. */
|
||||
String archiveName;
|
||||
|
||||
/** Name of table's category. */
|
||||
String categoryName;
|
||||
|
||||
/** Table control. */
|
||||
private Table table;
|
||||
|
||||
|
@ -82,13 +97,11 @@ public class ArchiveTableComp extends Composite {
|
|||
/** Size label. */
|
||||
private Label sizeLbl;
|
||||
|
||||
/** Table type enumeration. */
|
||||
public enum TableType {
|
||||
Retention, Case
|
||||
};
|
||||
/** Composite for holding the table */
|
||||
Composite tblComp;
|
||||
|
||||
/** Current table type. */
|
||||
private final TableType type;
|
||||
/** The dialog's type. */
|
||||
private final ArchiveConstants.Type type;
|
||||
|
||||
/** Allows the parent dialog log to update other total displays. */
|
||||
private final IArchiveTotals iArchiveTotals;
|
||||
|
@ -106,6 +119,11 @@ public class ArchiveTableComp extends Composite {
|
|||
*/
|
||||
private final List<IModifyListener> modifiedListeners = new CopyOnWriteArrayList<IModifyListener>();
|
||||
|
||||
/**
|
||||
* Use to update the selections for size job queues.
|
||||
*/
|
||||
private final SizeJob sizeJob;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
@ -114,12 +132,13 @@ public class ArchiveTableComp extends Composite {
|
|||
* @param type
|
||||
* Table type.
|
||||
*/
|
||||
public ArchiveTableComp(Composite parent, TableType type,
|
||||
IArchiveTotals iTotalSelectedSize) {
|
||||
public ArchiveTableComp(Composite parent, Type type,
|
||||
IArchiveTotals iTotalSelectedSize, SizeJob sizeJob) {
|
||||
super(parent, 0);
|
||||
|
||||
this.type = type;
|
||||
this.iArchiveTotals = iTotalSelectedSize;
|
||||
this.sizeJob = sizeJob;
|
||||
init();
|
||||
}
|
||||
|
||||
|
@ -137,7 +156,7 @@ public class ArchiveTableComp extends Composite {
|
|||
|
||||
createTable();
|
||||
|
||||
if (type != TableType.Retention) {
|
||||
if (type != Type.Retention) {
|
||||
createTableLabels();
|
||||
}
|
||||
}
|
||||
|
@ -148,11 +167,20 @@ public class ArchiveTableComp extends Composite {
|
|||
private void createTable() {
|
||||
GridData gd = null;
|
||||
|
||||
table = new Table(this, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL
|
||||
| SWT.H_SCROLL | SWT.MULTI | SWT.VIRTUAL);
|
||||
tblComp = new Composite(this, SWT.NONE);
|
||||
GridLayout gl = new GridLayout(1, false);
|
||||
gl.marginHeight = 0;
|
||||
gl.marginWidth = 0;
|
||||
gl.horizontalSpacing = 0;
|
||||
tblComp.setLayout(gl);
|
||||
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, true);
|
||||
gd.widthHint = 730;
|
||||
gd.heightHint = 270;
|
||||
tblComp.setLayoutData(gd);
|
||||
|
||||
table = new Table(tblComp, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL
|
||||
| SWT.H_SCROLL | SWT.MULTI | SWT.VIRTUAL);
|
||||
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
table.setLayoutData(gd);
|
||||
table.setHeaderVisible(true);
|
||||
table.setLinesVisible(true);
|
||||
|
@ -163,8 +191,15 @@ public class ArchiveTableComp extends Composite {
|
|||
TableItem item = (TableItem) event.item;
|
||||
int index = table.indexOf(item);
|
||||
DisplayData displayData = tableData[index];
|
||||
item.setText(new String[] { displayData.getDisplayLabel(),
|
||||
displayData.getSizeLabel() });
|
||||
String label = null;
|
||||
if (showSelectAll) {
|
||||
label = displayData.getArchiveName() + " | "
|
||||
+ displayData.getCategoryName() + " | "
|
||||
+ displayData.getDisplayLabel();
|
||||
} else {
|
||||
label = displayData.getDisplayLabel();
|
||||
}
|
||||
item.setText(new String[] { label, displayData.getSizeLabel() });
|
||||
item.setChecked(displayData.isSelected());
|
||||
}
|
||||
});
|
||||
|
@ -173,9 +208,9 @@ public class ArchiveTableComp extends Composite {
|
|||
pathColumn.setText("Label");
|
||||
|
||||
TableColumn sizeColumn = new TableColumn(table, SWT.CENTER);
|
||||
if (type == TableType.Retention) {
|
||||
if (type == Type.Retention) {
|
||||
sizeColumn.setText("Current Size");
|
||||
} else if (type == TableType.Case) {
|
||||
} else if (type == Type.Case) {
|
||||
sizeColumn.setText("Size");
|
||||
}
|
||||
|
||||
|
@ -285,7 +320,7 @@ public class ArchiveTableComp extends Composite {
|
|||
TableItem item = table.getItem(index);
|
||||
if (item.getChecked()) {
|
||||
++count;
|
||||
displayData.setSelected(true);
|
||||
sizeJob.setSelect(displayData, true);
|
||||
if (tableTotalSize >= 0) {
|
||||
long diSize = displayData.getSize();
|
||||
if (diSize < 0) {
|
||||
|
@ -295,7 +330,7 @@ public class ArchiveTableComp extends Composite {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
displayData.setSelected(false);
|
||||
sizeJob.setSelect(displayData, false);
|
||||
}
|
||||
}
|
||||
List<DisplayData> displayDatas = Arrays.asList(tableData);
|
||||
|
@ -422,12 +457,31 @@ public class ArchiveTableComp extends Composite {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set up table with values in the list.
|
||||
* Update table display to show data for the desired category.
|
||||
*
|
||||
* @param displayDatas
|
||||
*/
|
||||
protected void populateTable(List<DisplayData> displayDatas) {
|
||||
protected void populateTable(String archiveName, String categoryName,
|
||||
List<DisplayData> displayDatas) {
|
||||
showSelectAll = false;
|
||||
table.getColumn(0).setText("Label");
|
||||
populateTable(displayDatas);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flag table as showing all selected data and update display.
|
||||
*
|
||||
* @param displayDatas
|
||||
*/
|
||||
protected void populateSelectAll(List<DisplayData> displayDatas) {
|
||||
showSelectAll = true;
|
||||
table.getColumn(0).setText("Archive | Category | Label");
|
||||
populateTable(displayDatas);
|
||||
}
|
||||
|
||||
private void populateTable(List<DisplayData> displayDatas) {
|
||||
tableData = displayDatas.toArray(new DisplayData[0]);
|
||||
Arrays.sort(tableData, DisplayData.LABEL_ORDER);
|
||||
table.removeAll();
|
||||
table.setItemCount(tableData.length);
|
||||
|
||||
|
@ -440,6 +494,15 @@ public class ArchiveTableComp extends Composite {
|
|||
table.setSortColumn(table.getColumn(LABEL_COL_INDEX));
|
||||
table.setSortDirection(SWT.UP);
|
||||
table.clearAll();
|
||||
updateSelectionLabels();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the current tables display.
|
||||
*/
|
||||
public void refresh() {
|
||||
table.clearAll();
|
||||
updateSelectionLabels();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* Exception to use when problem creating a case.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 22, 2013 2225 rferrel Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author rferrel
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class CaseCreateException extends Exception {
|
||||
static final long serialVersionUID = 0L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public CaseCreateException() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message
|
||||
*/
|
||||
public CaseCreateException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cause
|
||||
*/
|
||||
public CaseCreateException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message
|
||||
* @param cause
|
||||
*/
|
||||
public CaseCreateException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
|
@ -21,11 +21,11 @@ package com.raytheon.uf.viz.archive.ui;
|
|||
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
|
||||
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
|
@ -38,7 +38,6 @@ import org.eclipse.swt.graphics.Point;
|
|||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.DirectoryDialog;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
|
@ -46,17 +45,11 @@ import org.eclipse.swt.widgets.Label;
|
|||
import org.eclipse.swt.widgets.Layout;
|
||||
import org.eclipse.swt.widgets.MessageBox;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Spinner;
|
||||
|
||||
import com.raytheon.uf.common.archive.config.ArchiveConstants.Type;
|
||||
import com.raytheon.uf.common.archive.config.DisplayData;
|
||||
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.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.ICloseCallback;
|
||||
|
@ -74,14 +67,17 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
|||
* May 23, 2013 #1964 lvenable Initial creation
|
||||
* Jun 10, 2013 #1966 rferrel Implemented back in hooks for display
|
||||
* and generation of cases.
|
||||
* Jul 24, 2013 #2220 rferrel Add recompute size button.
|
||||
* Jul 24, 2013 #2221 rferrel Changes for select configuration.
|
||||
* Aug 06, 2013 #2222 rferrel Changes to display all selected data.
|
||||
* Aug 26, 2013 #2225 rferrel Make perspective independent and no longer modal.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
* @version 1.0
|
||||
*/
|
||||
public class CaseCreationDlg extends AbstractArchiveDlg implements
|
||||
IArchiveTotals, IUpdateListener {
|
||||
public class CaseCreationDlg extends AbstractArchiveDlg {
|
||||
|
||||
/** Start time label. */
|
||||
private Label startTimeLbl;
|
||||
|
@ -104,17 +100,30 @@ public class CaseCreationDlg extends AbstractArchiveDlg implements
|
|||
/** Compression check box. */
|
||||
private Button compressChk;
|
||||
|
||||
/** Break files check box. */
|
||||
private Button breakFilesChk;
|
||||
// TODO restore when Multi-file implemented.
|
||||
// /** Break files check box. */
|
||||
// private Button breakFilesChk;
|
||||
|
||||
/** File size spinner control. */
|
||||
private Spinner fileSizeSpnr;
|
||||
/** Button to save new select case configuration. */
|
||||
private Button saveAsBtn;
|
||||
|
||||
/** File size combo box. */
|
||||
private Combo fileSizeCbo;
|
||||
/** Button to load select case configuration. */
|
||||
private Button loadBtn;
|
||||
|
||||
/** Maximum file size label. */
|
||||
private Label maxFileSizeLbl;
|
||||
/** Button to delete select case configuration. */
|
||||
private Button deleteBtn;
|
||||
|
||||
// TODO restore when Multi-file implemented.
|
||||
// /** File size spinner control. */
|
||||
// private Spinner fileSizeSpnr;
|
||||
|
||||
// TODO restore when Multi-file implemented.
|
||||
// /** File size combo box. */
|
||||
// private Combo fileSizeCbo;
|
||||
|
||||
// TODO restore when Multi-file implemented.
|
||||
// /** Maximum file size label. */
|
||||
// private Label maxFileSizeLbl;
|
||||
|
||||
/** Directory location label. */
|
||||
private Label locationLbl;
|
||||
|
@ -138,6 +147,21 @@ public class CaseCreationDlg extends AbstractArchiveDlg implements
|
|||
/** Number of selected items. */
|
||||
private int selectedItemsSize = 0;
|
||||
|
||||
/** Dialog to create new select case. */
|
||||
private CaseLoadSaveDeleteDlg saveAsDlg;
|
||||
|
||||
/** Dialog to load a select case. */
|
||||
private CaseLoadSaveDeleteDlg loadDlg;
|
||||
|
||||
/** Dialog to delete a select case. */
|
||||
private CaseLoadSaveDeleteDlg deleteDlg;
|
||||
|
||||
/** Allow only single instance of dialog. */
|
||||
private CaseNameDialog caseNameDlg;
|
||||
|
||||
/** Allow only single instance of dialog. */
|
||||
private GenerateCaseDlg generateCaseDlg;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
@ -146,9 +170,11 @@ public class CaseCreationDlg extends AbstractArchiveDlg implements
|
|||
*/
|
||||
public CaseCreationDlg(Shell parentShell) {
|
||||
super(parentShell, SWT.DIALOG_TRIM | SWT.MIN, CAVE.DO_NOT_BLOCK
|
||||
| CAVE.MODE_INDEPENDENT | CAVE.INDEPENDENT_SHELL);
|
||||
| CAVE.PERSPECTIVE_INDEPENDENT | CAVE.MODE_INDEPENDENT
|
||||
| CAVE.INDEPENDENT_SHELL);
|
||||
this.type = Type.Case;
|
||||
this.setSelect = false;
|
||||
this.tableType = TableType.Case;
|
||||
this.type = Type.Case;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -176,7 +202,7 @@ public class CaseCreationDlg extends AbstractArchiveDlg implements
|
|||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
super.initializeComponents(shell);
|
||||
setText("Archive Case Creation");
|
||||
setText("Archive Case Creation -");
|
||||
Composite mainComp = new Composite(shell, SWT.NONE);
|
||||
GridLayout gl = new GridLayout(1, false);
|
||||
gl.marginHeight = 0;
|
||||
|
@ -238,13 +264,29 @@ public class CaseCreationDlg extends AbstractArchiveDlg implements
|
|||
gd = new GridData(220, SWT.DEFAULT);
|
||||
endTimeLbl = new Label(timeComp, SWT.BORDER);
|
||||
endTimeLbl.setLayoutData(gd);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#setRetentionTimes(long)
|
||||
*/
|
||||
@Override
|
||||
public void setRetentionTimes(long startRetentionHours) {
|
||||
long startTimeOffset = startRetentionHours * TimeUtil.MILLIS_PER_HOUR;
|
||||
endDate = TimeUtil.newDate();
|
||||
long time = endDate.getTime();
|
||||
time -= TimeUtil.MILLIS_PER_DAY;
|
||||
time -= startTimeOffset;
|
||||
startDate = new Date(time);
|
||||
startTimeLbl.setText(dateFmt.format(startDate));
|
||||
endTimeLbl.setText(dateFmt.format(endDate));
|
||||
VizApp.runAsync(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
startTimeLbl.setText(dateFmt.format(startDate));
|
||||
endTimeLbl.setText(dateFmt.format(endDate));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -330,58 +372,60 @@ public class CaseCreationDlg extends AbstractArchiveDlg implements
|
|||
*/
|
||||
compressChk = new Button(compressionComp, SWT.CHECK);
|
||||
compressChk.setText("Compress Files");
|
||||
compressChk.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
handleCompressSelection();
|
||||
}
|
||||
});
|
||||
// TODO restore when Multi-file implemented.
|
||||
// compressChk.addSelectionListener(new SelectionAdapter() {
|
||||
// @Override
|
||||
// public void widgetSelected(SelectionEvent e) {
|
||||
// handleCompressSelection();
|
||||
// }
|
||||
// });
|
||||
|
||||
gd = new GridData();
|
||||
gd.horizontalIndent = 20;
|
||||
breakFilesChk = new Button(compressionComp, SWT.CHECK);
|
||||
breakFilesChk.setText("Break into multiple files");
|
||||
breakFilesChk.setLayoutData(gd);
|
||||
breakFilesChk.setEnabled(false);
|
||||
breakFilesChk.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
handleBreakFilesSelection(breakFilesChk.getSelection());
|
||||
}
|
||||
});
|
||||
// TODO restore when Multi-file implemented.
|
||||
// gd = new GridData();
|
||||
// gd.horizontalIndent = 20;
|
||||
// breakFilesChk = new Button(compressionComp, SWT.CHECK);
|
||||
// breakFilesChk.setText("Break into multiple files");
|
||||
// breakFilesChk.setLayoutData(gd);
|
||||
// breakFilesChk.setEnabled(false);
|
||||
// breakFilesChk.addSelectionListener(new SelectionAdapter() {
|
||||
// @Override
|
||||
// public void widgetSelected(SelectionEvent e) {
|
||||
// handleBreakFilesSelection(breakFilesChk.getSelection());
|
||||
// }
|
||||
// });
|
||||
|
||||
Composite maxFileSizeComp = new Composite(compressionComp, SWT.NONE);
|
||||
gl = new GridLayout(3, false);
|
||||
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
gd.horizontalIndent = 20;
|
||||
maxFileSizeComp.setLayout(gl);
|
||||
maxFileSizeComp.setLayoutData(gd);
|
||||
|
||||
maxFileSizeLbl = new Label(maxFileSizeComp, SWT.NONE);
|
||||
maxFileSizeLbl.setText("Max File Size: ");
|
||||
maxFileSizeLbl.setEnabled(false);
|
||||
|
||||
gd = new GridData(60, SWT.DEFAULT);
|
||||
fileSizeSpnr = new Spinner(maxFileSizeComp, SWT.BORDER);
|
||||
fileSizeSpnr.setIncrement(1);
|
||||
fileSizeSpnr.setPageIncrement(50);
|
||||
fileSizeSpnr.setMaximum(2000);
|
||||
fileSizeSpnr.setMinimum(500);
|
||||
fileSizeSpnr.setLayoutData(gd);
|
||||
fileSizeSpnr.setEnabled(false);
|
||||
|
||||
fileSizeCbo = new Combo(maxFileSizeComp, SWT.VERTICAL | SWT.DROP_DOWN
|
||||
| SWT.BORDER | SWT.READ_ONLY);
|
||||
fileSizeCbo.setEnabled(false);
|
||||
fileSizeCbo.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
handleFileSizeChangeSelection();
|
||||
}
|
||||
});
|
||||
fileSizeCbo.add("MB");
|
||||
fileSizeCbo.add("GB");
|
||||
fileSizeCbo.select(0);
|
||||
// Composite maxFileSizeComp = new Composite(compressionComp, SWT.NONE);
|
||||
// gl = new GridLayout(3, false);
|
||||
// gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
// gd.horizontalIndent = 20;
|
||||
// maxFileSizeComp.setLayout(gl);
|
||||
// maxFileSizeComp.setLayoutData(gd);
|
||||
//
|
||||
// maxFileSizeLbl = new Label(maxFileSizeComp, SWT.NONE);
|
||||
// maxFileSizeLbl.setText("Max File Size: ");
|
||||
// maxFileSizeLbl.setEnabled(false);
|
||||
//
|
||||
// gd = new GridData(60, SWT.DEFAULT);
|
||||
// fileSizeSpnr = new Spinner(maxFileSizeComp, SWT.BORDER);
|
||||
// fileSizeSpnr.setIncrement(1);
|
||||
// fileSizeSpnr.setPageIncrement(50);
|
||||
// fileSizeSpnr.setMaximum(2000);
|
||||
// fileSizeSpnr.setMinimum(500);
|
||||
// fileSizeSpnr.setLayoutData(gd);
|
||||
// fileSizeSpnr.setEnabled(false);
|
||||
//
|
||||
// fileSizeCbo = new Combo(maxFileSizeComp, SWT.VERTICAL | SWT.DROP_DOWN
|
||||
// | SWT.BORDER | SWT.READ_ONLY);
|
||||
// fileSizeCbo.setEnabled(false);
|
||||
// fileSizeCbo.addSelectionListener(new SelectionAdapter() {
|
||||
// @Override
|
||||
// public void widgetSelected(SelectionEvent e) {
|
||||
// handleFileSizeChangeSelection();
|
||||
// }
|
||||
// });
|
||||
// fileSizeCbo.add("MB");
|
||||
// fileSizeCbo.add("GB");
|
||||
// fileSizeCbo.select(0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -425,7 +469,7 @@ public class CaseCreationDlg extends AbstractArchiveDlg implements
|
|||
private void createBottomActionButtons() {
|
||||
|
||||
Composite actionControlComp = new Composite(shell, SWT.NONE);
|
||||
GridLayout gl = new GridLayout(3, false);
|
||||
GridLayout gl = new GridLayout(8, false);
|
||||
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
actionControlComp.setLayout(gl);
|
||||
actionControlComp.setLayoutData(gd);
|
||||
|
@ -441,6 +485,44 @@ public class CaseCreationDlg extends AbstractArchiveDlg implements
|
|||
// }
|
||||
// });
|
||||
|
||||
saveBtn = new Button(actionControlComp, SWT.PUSH);
|
||||
saveBtn.setText(" Save ");
|
||||
saveBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent selectionEvent) {
|
||||
saveSelection(selectName);
|
||||
clearModified();
|
||||
}
|
||||
});
|
||||
saveBtn.setEnabled(false);
|
||||
|
||||
saveAsBtn = new Button(actionControlComp, SWT.PUSH);
|
||||
saveAsBtn.setText(" Save As... ");
|
||||
saveAsBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent selectionEvent) {
|
||||
handleSaveAsCase();
|
||||
}
|
||||
});
|
||||
|
||||
loadBtn = new Button(actionControlComp, SWT.PUSH);
|
||||
loadBtn.setText(" Load... ");
|
||||
loadBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent selectionEvent) {
|
||||
handleLoadCase();
|
||||
}
|
||||
});
|
||||
|
||||
deleteBtn = new Button(actionControlComp, SWT.PUSH);
|
||||
deleteBtn.setText(" Delete... ");
|
||||
deleteBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent selectionEvent) {
|
||||
handleDeleteCase();
|
||||
}
|
||||
});
|
||||
|
||||
generateBtn = new Button(actionControlComp, SWT.PUSH);
|
||||
generateBtn.setText(" Generate ");
|
||||
generateBtn.setEnabled(false);
|
||||
|
@ -451,6 +533,18 @@ public class CaseCreationDlg extends AbstractArchiveDlg implements
|
|||
}
|
||||
});
|
||||
|
||||
createShowingSelectedBtn(actionControlComp);
|
||||
|
||||
Button sizeBtn = new Button(actionControlComp, SWT.PUSH);
|
||||
sizeBtn.setText(" Recompute Sizes ");
|
||||
sizeBtn.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
resetSizes();
|
||||
}
|
||||
});
|
||||
|
||||
gd = new GridData(SWT.RIGHT, SWT.DEFAULT, true, false);
|
||||
Button closeBtn = new Button(actionControlComp, SWT.PUSH);
|
||||
closeBtn.setText(" Close ");
|
||||
|
@ -458,13 +552,91 @@ public class CaseCreationDlg extends AbstractArchiveDlg implements
|
|||
closeBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
close();
|
||||
if (verifyClose()) {
|
||||
close();
|
||||
} else {
|
||||
e.doit = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void handleSaveAsCase() {
|
||||
if (saveAsDlg == null || saveAsDlg.isDisposed()) {
|
||||
saveAsDlg = new CaseLoadSaveDeleteDlg(shell,
|
||||
CaseLoadSaveDeleteDlg.Type.SaveAs);
|
||||
saveAsDlg.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof String) {
|
||||
String name = returnValue.toString();
|
||||
if (saveSelection(name)) {
|
||||
clearModified();
|
||||
loadSelect(name);
|
||||
setSelectName(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
saveAsDlg.open();
|
||||
} else {
|
||||
saveAsDlg.bringToTop();
|
||||
}
|
||||
}
|
||||
|
||||
private void handleLoadCase() {
|
||||
if (isModified()
|
||||
&& !MessageDialog.openConfirm(shell, "Case Confirmation",
|
||||
"Unsave changes will be lost.\nPress OK to continue.")) {
|
||||
return;
|
||||
|
||||
}
|
||||
if (loadDlg == null || loadDlg.isDisposed()) {
|
||||
loadDlg = new CaseLoadSaveDeleteDlg(shell,
|
||||
CaseLoadSaveDeleteDlg.Type.Load);
|
||||
loadDlg.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof String) {
|
||||
String name = returnValue.toString();
|
||||
loadSelect(name);
|
||||
populateTableComp();
|
||||
updateTotals(null);
|
||||
setSelectName(name);
|
||||
clearModified();
|
||||
}
|
||||
}
|
||||
});
|
||||
loadDlg.open();
|
||||
} else {
|
||||
loadDlg.bringToTop();
|
||||
}
|
||||
}
|
||||
|
||||
private void handleDeleteCase() {
|
||||
if (deleteDlg == null || deleteDlg.isDisposed()) {
|
||||
deleteDlg = new CaseLoadSaveDeleteDlg(shell,
|
||||
CaseLoadSaveDeleteDlg.Type.Delete);
|
||||
deleteDlg.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof String) {
|
||||
String selectName = returnValue.toString();
|
||||
deleteSelect(selectName);
|
||||
}
|
||||
}
|
||||
});
|
||||
deleteDlg.open();
|
||||
} else {
|
||||
deleteDlg.bringToTop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display modal dialog that performs the Generation of the case.
|
||||
* Display dialog that performs the Generation of the case.
|
||||
*/
|
||||
private void generateCase() {
|
||||
setCursorBusy(true);
|
||||
|
@ -475,50 +647,71 @@ public class CaseCreationDlg extends AbstractArchiveDlg implements
|
|||
|
||||
List<DisplayData> displayDatas = getSelectedData();
|
||||
boolean doCompress = compressChk.getSelection();
|
||||
boolean doMultiFiles = breakFilesChk.getSelection();
|
||||
int compressSize = fileSizeSpnr.getSelection();
|
||||
String sizeType = fileSizeCbo.getItem(fileSizeCbo.getSelectionIndex());
|
||||
|
||||
// Assume Model dialog.
|
||||
GenerateCaseDlg dialog = new GenerateCaseDlg(shell, targetDir, caseDir,
|
||||
startCal, endCal, displayDatas, doCompress, doMultiFiles,
|
||||
compressSize, sizeType);
|
||||
dialog.addJobChangeListener(new JobChangeAdapter() {
|
||||
// TODO restore once Multi-file implemented.
|
||||
// boolean doMultiFiles = breakFilesChk.getSelection();
|
||||
// int compressSize = fileSizeSpnr.getSelection();
|
||||
// String sizeType =
|
||||
// fileSizeCbo.getItem(fileSizeCbo.getSelectionIndex());
|
||||
boolean doMultiFiles = false;
|
||||
int compressSize = 500;
|
||||
String sizeType = "MB";
|
||||
|
||||
@Override
|
||||
public void done(IJobChangeEvent event) {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
updateLocationState();
|
||||
}
|
||||
});
|
||||
setCursorBusy(true);
|
||||
if (generateCaseDlg == null || generateCaseDlg.isDisposed()) {
|
||||
long splitSize = 0L;
|
||||
if (doCompress && doMultiFiles) {
|
||||
if (sizeType.equals("MB")) {
|
||||
splitSize = compressSize * FileUtils.ONE_MB;
|
||||
} else {
|
||||
splitSize = compressSize * FileUtils.ONE_GB;
|
||||
}
|
||||
}
|
||||
});
|
||||
dialog.setCloseCallback(new ICloseCallback() {
|
||||
generateCaseDlg = new GenerateCaseDlg(shell, targetDir, caseDir,
|
||||
startCal, endCal, displayDatas, doCompress, doMultiFiles,
|
||||
splitSize);
|
||||
generateCaseDlg.addJobChangeListener(new JobChangeAdapter() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
setCursorBusy(false);
|
||||
}
|
||||
});
|
||||
dialog.open();
|
||||
@Override
|
||||
public void done(IJobChangeEvent event) {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
updateLocationState();
|
||||
setCursorBusy(false);
|
||||
generateCaseDlg = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
generateCaseDlg.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/Disable controls based on the compression check box.
|
||||
*/
|
||||
private void handleCompressSelection() {
|
||||
if (compressChk.getSelection()) {
|
||||
handleBreakFilesSelection(breakFilesChk.getSelection());
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
setCursorBusy(false);
|
||||
}
|
||||
});
|
||||
generateCaseDlg.open();
|
||||
} else {
|
||||
handleBreakFilesSelection(false);
|
||||
generateCaseDlg.bringToTop();
|
||||
}
|
||||
|
||||
breakFilesChk.setEnabled(compressChk.getSelection());
|
||||
}
|
||||
|
||||
// TODO restore when Multi-file implemented.
|
||||
// /**
|
||||
// * Enable/Disable controls based on the compression check box.
|
||||
// */
|
||||
// private void handleCompressSelection() {
|
||||
// if (compressChk.getSelection()) {
|
||||
// handleBreakFilesSelection(breakFilesChk.getSelection());
|
||||
// } else {
|
||||
// handleBreakFilesSelection(false);
|
||||
// }
|
||||
//
|
||||
// breakFilesChk.setEnabled(compressChk.getSelection());
|
||||
// }
|
||||
|
||||
/**
|
||||
* Bring up modal dialog to get the case's directory name.
|
||||
*/
|
||||
|
@ -531,35 +724,43 @@ public class CaseCreationDlg extends AbstractArchiveDlg implements
|
|||
}
|
||||
|
||||
File targetDir = (File) o;
|
||||
// Assume modal dialog.
|
||||
CaseNameDialog dialog = new CaseNameDialog(shell, targetDir);
|
||||
dialog.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof File) {
|
||||
File caseDir = (File) returnValue;
|
||||
String caseName = caseDir.getAbsolutePath();
|
||||
caseNameLbl.setText(caseName);
|
||||
caseNameLbl.setData(caseDir);
|
||||
checkGenerateButton();
|
||||
setCursorBusy(true);
|
||||
if (caseNameDlg == null || caseNameDlg.isDisposed()) {
|
||||
caseNameDlg = new CaseNameDialog(shell, targetDir);
|
||||
caseNameDlg.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof File) {
|
||||
File caseDir = (File) returnValue;
|
||||
String caseName = caseDir.getAbsolutePath();
|
||||
caseNameLbl.setText(caseName);
|
||||
caseNameLbl.setData(caseDir);
|
||||
checkGenerateButton();
|
||||
}
|
||||
caseNameDlg = null;
|
||||
setCursorBusy(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
dialog.open();
|
||||
});
|
||||
caseNameDlg.open();
|
||||
} else {
|
||||
caseNameDlg.bringToTop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/Disable file size controls.
|
||||
*
|
||||
* @param enabled
|
||||
* Enabled flag.
|
||||
*/
|
||||
private void handleBreakFilesSelection(boolean enabled) {
|
||||
maxFileSizeLbl.setEnabled(enabled);
|
||||
fileSizeSpnr.setEnabled(enabled);
|
||||
fileSizeCbo.setEnabled(enabled);
|
||||
}
|
||||
// TODO restore when Multi-file implemented.
|
||||
// /**
|
||||
// * Enable/Disable file size controls.
|
||||
// *
|
||||
// * @param enabled
|
||||
// * Enabled flag.
|
||||
// */
|
||||
// private void handleBreakFilesSelection(boolean enabled) {
|
||||
// maxFileSizeLbl.setEnabled(enabled);
|
||||
// fileSizeSpnr.setEnabled(enabled);
|
||||
// fileSizeCbo.setEnabled(enabled);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Enables the generate button will user has entered all needed elements.
|
||||
|
@ -571,35 +772,36 @@ public class CaseCreationDlg extends AbstractArchiveDlg implements
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Action performed when the file size has changed.
|
||||
*/
|
||||
private void handleFileSizeChangeSelection() {
|
||||
/*
|
||||
* If the same item was selected just return.
|
||||
*/
|
||||
if (fileSizeCbo.getItem(fileSizeCbo.getSelectionIndex()).equals(
|
||||
(String) fileSizeCbo.getData())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (fileSizeCbo.getItem(fileSizeCbo.getSelectionIndex()).equals("MB")) {
|
||||
fileSizeSpnr.setIncrement(1);
|
||||
fileSizeSpnr.setPageIncrement(50);
|
||||
fileSizeSpnr.setMaximum(2000);
|
||||
fileSizeSpnr.setMinimum(500);
|
||||
fileSizeSpnr.setSelection(500);
|
||||
} else {
|
||||
fileSizeSpnr.setIncrement(1);
|
||||
fileSizeSpnr.setPageIncrement(5);
|
||||
fileSizeSpnr.setMinimum(1);
|
||||
fileSizeSpnr.setMaximum(10);
|
||||
fileSizeSpnr.setSelection(1);
|
||||
}
|
||||
|
||||
fileSizeCbo
|
||||
.setData(fileSizeCbo.getItem(fileSizeCbo.getSelectionIndex()));
|
||||
}
|
||||
// TODO restore when Multi-file implemented.
|
||||
// /**
|
||||
// * Action performed when the file size has changed.
|
||||
// */
|
||||
// private void handleFileSizeChangeSelection() {
|
||||
// /*
|
||||
// * If the same item was selected just return.
|
||||
// */
|
||||
// if (fileSizeCbo.getItem(fileSizeCbo.getSelectionIndex()).equals(
|
||||
// (String) fileSizeCbo.getData())) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (fileSizeCbo.getItem(fileSizeCbo.getSelectionIndex()).equals("MB")) {
|
||||
// fileSizeSpnr.setIncrement(1);
|
||||
// fileSizeSpnr.setPageIncrement(50);
|
||||
// fileSizeSpnr.setMaximum(2000);
|
||||
// fileSizeSpnr.setMinimum(500);
|
||||
// fileSizeSpnr.setSelection(500);
|
||||
// } else {
|
||||
// fileSizeSpnr.setIncrement(1);
|
||||
// fileSizeSpnr.setPageIncrement(5);
|
||||
// fileSizeSpnr.setMinimum(1);
|
||||
// fileSizeSpnr.setMaximum(10);
|
||||
// fileSizeSpnr.setSelection(1);
|
||||
// }
|
||||
//
|
||||
// fileSizeCbo
|
||||
// .setData(fileSizeCbo.getItem(fileSizeCbo.getSelectionIndex()));
|
||||
// }
|
||||
|
||||
/**
|
||||
* Display the directory browser dialog.
|
||||
|
@ -624,6 +826,9 @@ public class CaseCreationDlg extends AbstractArchiveDlg implements
|
|||
* Update location's state.
|
||||
*/
|
||||
private void updateLocationState() {
|
||||
if (isDisposed()) {
|
||||
return;
|
||||
}
|
||||
File dir = (File) locationLbl.getData();
|
||||
long totSpace = dir.getTotalSpace();
|
||||
long freeSpace = dir.getUsableSpace();
|
||||
|
@ -665,49 +870,57 @@ public class CaseCreationDlg extends AbstractArchiveDlg implements
|
|||
* True for start time, false for end time.
|
||||
*/
|
||||
private void displayDateTimeControls(boolean startTimeFlag) {
|
||||
setCursorBusy(true);
|
||||
try {
|
||||
Date acDate = startTimeFlag ? startDate : endDate;
|
||||
AwipsCalendar ac = new AwipsCalendar(shell, acDate, 1);
|
||||
ac.setTimeZone(TimeUtil.newCalendar().getTimeZone());
|
||||
ac.setText((startTimeFlag ? "Start" : "End") + " Time Calendar");
|
||||
|
||||
Date acDate = startTimeFlag ? startDate : endDate;
|
||||
AwipsCalendar ac = new AwipsCalendar(shell, acDate, 1);
|
||||
ac.setTimeZone(TimeUtil.newCalendar().getTimeZone());
|
||||
Date date = (Date) ac.open();
|
||||
Date date = (Date) ac.open();
|
||||
|
||||
if (date == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (startTimeFlag) {
|
||||
if (date.after(endDate)) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION
|
||||
| SWT.OK);
|
||||
mb.setText("Date Error");
|
||||
mb.setMessage("The selected start date is after the end date. Resetting.");
|
||||
mb.open();
|
||||
if (date == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!startDate.equals(date)) {
|
||||
startDate = date;
|
||||
resetSizes();
|
||||
}
|
||||
} else {
|
||||
if (date.before(startDate)) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION
|
||||
| SWT.OK);
|
||||
mb.setText("Date Error");
|
||||
mb.setMessage("The selected end date is before the start date. Resetting.");
|
||||
mb.open();
|
||||
return;
|
||||
}
|
||||
if (!endDate.equals(date)) {
|
||||
endDate = date;
|
||||
resetSizes();
|
||||
}
|
||||
}
|
||||
if (startTimeFlag) {
|
||||
if (date.after(endDate)) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION
|
||||
| SWT.OK);
|
||||
mb.setText("Date Error");
|
||||
mb.setMessage("The selected start date is after the end date. Resetting.");
|
||||
mb.open();
|
||||
return;
|
||||
}
|
||||
|
||||
if (startTimeFlag) {
|
||||
startTimeLbl.setText(dateFmt.format(date));
|
||||
} else {
|
||||
endTimeLbl.setText(dateFmt.format(date));
|
||||
if (!startDate.equals(date)) {
|
||||
startDate = date;
|
||||
sizeJob.resetTime(getStart(), getEnd());
|
||||
modified();
|
||||
}
|
||||
} else {
|
||||
if (date.before(startDate)) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION
|
||||
| SWT.OK);
|
||||
mb.setText("Date Error");
|
||||
mb.setMessage("The selected end date is before the start date. Resetting.");
|
||||
mb.open();
|
||||
return;
|
||||
}
|
||||
if (!endDate.equals(date)) {
|
||||
endDate = date;
|
||||
sizeJob.resetTime(getStart(), getEnd());
|
||||
modified();
|
||||
}
|
||||
}
|
||||
|
||||
if (startTimeFlag) {
|
||||
startTimeLbl.setText(dateFmt.format(date));
|
||||
} else {
|
||||
endTimeLbl.setText(dateFmt.format(date));
|
||||
}
|
||||
} finally {
|
||||
setCursorBusy(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -752,73 +965,12 @@ public class CaseCreationDlg extends AbstractArchiveDlg implements
|
|||
checkGenerateButton();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset all entries to unknown size, recompute the sizes for the current
|
||||
* display table and and other selected entries.
|
||||
*/
|
||||
private void resetSizes() {
|
||||
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
|
||||
.getDisplayDataList()) {
|
||||
displayData.setSize(DisplayData.UNKNOWN_SIZE);
|
||||
if (displayData.isSelected()) {
|
||||
selectedDatas.add(displayData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
populateTableComp();
|
||||
|
||||
if (selectedDatas.size() > 0) {
|
||||
String archiveName = getSelectedArchiveName();
|
||||
String categoryName = getSelectedCategoryName();
|
||||
Calendar startCal = getStart();
|
||||
Calendar endCal = getEnd();
|
||||
|
||||
for (DisplayData displayData : selectedDatas) {
|
||||
if (!displayData.isArchive(archiveName)
|
||||
|| !displayData.isCategory(categoryName)) {
|
||||
sizeJob.queue(new SizeJobRequest(displayData, startCal,
|
||||
endCal));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the data information on all selected items; not just the currently
|
||||
* displayed table.
|
||||
*
|
||||
* @return selectedDatas
|
||||
*/
|
||||
private List<DisplayData> getSelectedData() {
|
||||
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
|
||||
.getDisplayDataList()) {
|
||||
if (displayData.isSelected()) {
|
||||
selectedDatas.add(displayData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return selectedDatas;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#getStart()
|
||||
*/
|
||||
// @Override
|
||||
@Override
|
||||
protected Calendar getStart() {
|
||||
Calendar startCal = TimeUtil.newCalendar();
|
||||
startCal.setTimeInMillis(startDate.getTime());
|
||||
|
@ -830,10 +982,31 @@ public class CaseCreationDlg extends AbstractArchiveDlg implements
|
|||
*
|
||||
* @see com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#getEnd()
|
||||
*/
|
||||
// @Override
|
||||
@Override
|
||||
protected Calendar getEnd() {
|
||||
Calendar endCal = TimeUtil.newCalendar();
|
||||
endCal.setTimeInMillis(endDate.getTime());
|
||||
return endCal;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.archive.ui.IModifyListener#modified()
|
||||
*/
|
||||
@Override
|
||||
public void modified() {
|
||||
saveBtn.setEnabled(true);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#clearModified()
|
||||
*/
|
||||
@Override
|
||||
public void clearModified() {
|
||||
super.clearModified();
|
||||
saveBtn.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,261 @@
|
|||
/**
|
||||
* 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.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.List;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
import com.raytheon.uf.common.archive.config.ArchiveConfigManager;
|
||||
import com.raytheon.uf.common.archive.config.ArchiveConstants;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
/**
|
||||
* Dialog to display a list of select files for Load, Save As or Delete.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 31, 2013 2221 rferrel Initial creation
|
||||
* Aug 26, 2013 2225 rferrel Make perspective independent.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author rferrel
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class CaseLoadSaveDeleteDlg extends CaveSWTDialog {
|
||||
public static enum Type {
|
||||
SaveAs("Save As", " Save "), Load("Load", " Load "), Delete("Delete",
|
||||
" Delete ");
|
||||
private String title;
|
||||
|
||||
private String btnLabel;
|
||||
|
||||
private Type(String title, String btnLabel) {
|
||||
this.title = title;
|
||||
this.btnLabel = btnLabel;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public String getBtnLabel() {
|
||||
return btnLabel;
|
||||
}
|
||||
}
|
||||
|
||||
private Type type;
|
||||
|
||||
private List caseList;
|
||||
|
||||
private Text fileNameText;
|
||||
|
||||
private Button okBtn;
|
||||
|
||||
private Button cancelBtn;
|
||||
|
||||
protected CaseLoadSaveDeleteDlg(Shell parentShell, Type type) {
|
||||
super(parentShell, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.DO_NOT_BLOCK
|
||||
| CAVE.PERSPECTIVE_INDEPENDENT);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
|
||||
* .eclipse.swt.widgets.Shell)
|
||||
*/
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
setText(type.getTitle() + " Case");
|
||||
Composite mainComp = new Composite(shell, SWT.NONE);
|
||||
GridLayout gl = new GridLayout(1, false);
|
||||
gl.marginHeight = 0;
|
||||
gl.marginWidth = 0;
|
||||
gl.horizontalSpacing = 0;
|
||||
mainComp.setLayout(gl);
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up dialog layout.
|
||||
*/
|
||||
private void init() {
|
||||
createCaseControls();
|
||||
GuiUtil.addSeparator(shell, SWT.HORIZONTAL);
|
||||
createBottomAcitonButtons();
|
||||
}
|
||||
|
||||
/**
|
||||
* Main body of the dialog.
|
||||
*/
|
||||
private void createCaseControls() {
|
||||
Composite caseComp = new Composite(shell, SWT.NONE);
|
||||
GridLayout gl = new GridLayout(1, false);
|
||||
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
caseComp.setLayout(gl);
|
||||
caseComp.setLayoutData(gd);
|
||||
|
||||
caseList = new List(caseComp, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
|
||||
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
gd.minimumHeight = 300;
|
||||
caseList.setLayoutData(gd);
|
||||
|
||||
caseList.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
fileNameText.setText(caseList.getSelection()[0]);
|
||||
}
|
||||
});
|
||||
|
||||
fileNameText = new Text(caseComp, SWT.BORDER | SWT.SINGLE);
|
||||
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
fileNameText.setLayoutData(gd);
|
||||
fileNameText.setEditable(type == Type.SaveAs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Button layout at the bottom of the dialog.
|
||||
*/
|
||||
private void createBottomAcitonButtons() {
|
||||
Composite actionControlComp = new Composite(shell, SWT.NONE);
|
||||
GridLayout gl = new GridLayout(2, false);
|
||||
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
actionControlComp.setLayout(gl);
|
||||
actionControlComp.setLayoutData(gd);
|
||||
okBtn = new Button(actionControlComp, SWT.PUSH);
|
||||
okBtn.setText(type.getBtnLabel());
|
||||
okBtn.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
String name = verifyAction();
|
||||
if (name != null) {
|
||||
setReturnValue(name);
|
||||
close();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
cancelBtn = new Button(actionControlComp, SWT.PUSH);
|
||||
cancelBtn.setText(" Cancel ");
|
||||
gd = new GridData(SWT.RIGHT, SWT.DEFAULT, true, false);
|
||||
cancelBtn.setLayoutData(gd);
|
||||
cancelBtn.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify pending action and return select case name to continue the action.
|
||||
*
|
||||
* @return name when ok to perform action otherwise null
|
||||
*/
|
||||
private String verifyAction() {
|
||||
String name = fileNameText.getText().trim();
|
||||
|
||||
if (name.isEmpty()) {
|
||||
MessageDialog.openError(shell, "Case Error", "Invalid case name.");
|
||||
name = null;
|
||||
} else {
|
||||
switch (type) {
|
||||
case Load:
|
||||
// No need to check since text is not editable.
|
||||
break;
|
||||
case SaveAs:
|
||||
for (String cName : caseList.getItems()) {
|
||||
if (name.equals(cName)) {
|
||||
boolean response = MessageDialog
|
||||
.openConfirm(
|
||||
shell,
|
||||
"Case Confirmation",
|
||||
"Case \""
|
||||
+ name
|
||||
+ "\" exists.\nSelect OK to overwrite.");
|
||||
if (!response) {
|
||||
name = null;
|
||||
fileNameText.selectAll();
|
||||
fileNameText.forceFocus();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Delete:
|
||||
if (!MessageDialog.openConfirm(shell, "Case Confirmation",
|
||||
"Press OK to delete \"" + name + "\".")) {
|
||||
name = null;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
name = null;
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialog#preOpened()
|
||||
*/
|
||||
@Override
|
||||
protected void preOpened() {
|
||||
super.preOpened();
|
||||
populateList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate case names in the list.
|
||||
*/
|
||||
private void populateList() {
|
||||
caseList.add(ArchiveConstants.defaultSelectName);
|
||||
String[] names = ArchiveConfigManager.getInstance().getSelectionNames(
|
||||
ArchiveConstants.Type.Case);
|
||||
for (String name : names) {
|
||||
if (!ArchiveConstants.defaultSelectName.equals(name)) {
|
||||
caseList.add(name);
|
||||
}
|
||||
}
|
||||
caseList.select(0);
|
||||
fileNameText.setText(caseList.getItem(0));
|
||||
}
|
||||
}
|
|
@ -47,6 +47,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 5, 2013 1966 rferrel Initial creation
|
||||
* Aug 26, 2013 2225 rferrel Make perspective independent.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -65,7 +66,7 @@ public class CaseNameDialog extends CaveSWTDialog {
|
|||
/** Non-blocking modal constructor. */
|
||||
protected CaseNameDialog(Shell parent, File locationDir) {
|
||||
super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL,
|
||||
CAVE.DO_NOT_BLOCK);
|
||||
CAVE.DO_NOT_BLOCK | CAVE.PERSPECTIVE_INDEPENDENT);
|
||||
this.locationDir = locationDir;
|
||||
}
|
||||
|
||||
|
@ -98,7 +99,7 @@ public class CaseNameDialog extends CaveSWTDialog {
|
|||
}
|
||||
|
||||
/**
|
||||
* The xomposite with case name text field.
|
||||
* The composite with case name text field.
|
||||
*/
|
||||
private void createFieldsComp() {
|
||||
Composite fieldComp = new Composite(shell, SWT.NONE);
|
||||
|
|
|
@ -19,12 +19,24 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.archive.ui;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
import org.apache.commons.compress.archivers.ArchiveOutputStream;
|
||||
import org.apache.commons.compress.archivers.ArchiveStreamFactory;
|
||||
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
|
||||
import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
|
@ -45,6 +57,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.ArchiveConstants;
|
||||
import com.raytheon.uf.common.archive.config.DisplayData;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
|
@ -54,7 +67,8 @@ import com.raytheon.uf.viz.core.VizApp;
|
|||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
/**
|
||||
* Class to show progress of creating a case.
|
||||
* This class performs the desired type of case creation and display a
|
||||
* progress/status message dialog.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -63,10 +77,14 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 3, 2013 1966 rferrel Initial creation
|
||||
* Aug 16, 2013 2225 rferrel Change structure of copy to include
|
||||
* archive and category directory and
|
||||
* implementation of compression.
|
||||
* Oct 08, 2013 2442 rferrel Remove category directory.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author rferrelGenerateJob
|
||||
* @author rferrel
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
|
@ -86,9 +104,6 @@ public class GenerateCaseDlg extends CaveSWTDialog {
|
|||
/** Active have generation is finish or has an error. */
|
||||
private Button closeBtn;
|
||||
|
||||
/** The main destination directory. */
|
||||
private final File targetDir;
|
||||
|
||||
/**
|
||||
* The case's destination directory. Assumed to be a sub-directory of
|
||||
* targetDir.
|
||||
|
@ -102,19 +117,17 @@ public class GenerateCaseDlg extends CaveSWTDialog {
|
|||
private final Calendar endCal;
|
||||
|
||||
/** Data list for the case. */
|
||||
private final List<DisplayData> sourceDataList;
|
||||
private final DisplayData[] sourceDataList;
|
||||
|
||||
/** When true compress the case directory. */
|
||||
private final boolean doCompress;
|
||||
|
||||
/** When true break the compress file into multliple files. */
|
||||
/** When true break the compress file into multiple files. */
|
||||
private final boolean doMultiFiles;
|
||||
|
||||
/** The compress size for muliple files. */
|
||||
private final int compressSize;
|
||||
|
||||
/** Assumed to be MG or GB to indicate scaling factor for compressSize. */
|
||||
private final String sizeType;
|
||||
// Needed when compress and split implemented
|
||||
// /** The compress size for multiple files. */
|
||||
// private final long splitSize;
|
||||
|
||||
/** Job to perform the case generation off of the UI thread. */
|
||||
private GenerateJob generateJob;
|
||||
|
@ -140,24 +153,24 @@ public class GenerateCaseDlg extends CaveSWTDialog {
|
|||
* @param sourceList
|
||||
* @param doCompress
|
||||
* @param doMultiFiles
|
||||
* @param compressSize
|
||||
* @param sizeType
|
||||
* @param splitSize
|
||||
*/
|
||||
protected GenerateCaseDlg(Shell parentShell, File targetDir, File caseDir,
|
||||
Calendar startCal, Calendar endCal, List<DisplayData> sourceList,
|
||||
boolean doCompress, boolean doMultiFiles, int compressSize,
|
||||
String sizeType) {
|
||||
super(parentShell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL,
|
||||
CAVE.DO_NOT_BLOCK);
|
||||
this.targetDir = targetDir;
|
||||
boolean doCompress, boolean doMultiFiles, long splitSize) {
|
||||
super(parentShell, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK
|
||||
| CAVE.PERSPECTIVE_INDEPENDENT);
|
||||
this.caseDir = caseDir;
|
||||
this.startCal = startCal;
|
||||
this.endCal = endCal;
|
||||
this.sourceDataList = new ArrayList<DisplayData>(sourceList);
|
||||
this.sourceDataList = sourceList.toArray(new DisplayData[sourceList
|
||||
.size()]);
|
||||
Arrays.sort(this.sourceDataList, DisplayData.LABEL_ORDER);
|
||||
this.doCompress = doCompress;
|
||||
this.doMultiFiles = doMultiFiles;
|
||||
this.compressSize = compressSize;
|
||||
this.sizeType = sizeType;
|
||||
|
||||
// Needed when compress and split implemented.
|
||||
// this.splitSize = splitSize;
|
||||
this.caseName = caseDir.getAbsolutePath().substring(
|
||||
targetDir.getAbsolutePath().length() + 1);
|
||||
setText("Generating - " + caseName);
|
||||
|
@ -173,7 +186,7 @@ public class GenerateCaseDlg extends CaveSWTDialog {
|
|||
}
|
||||
|
||||
/**
|
||||
* Remve a job listener.
|
||||
* Remove a job listener.
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
|
@ -357,10 +370,10 @@ public class GenerateCaseDlg extends CaveSWTDialog {
|
|||
* The performs the work of generating the case on a non-UI thread.
|
||||
*/
|
||||
private class GenerateJob extends Job {
|
||||
boolean shutdown = false;
|
||||
private final AtomicBoolean shutdown = new AtomicBoolean(false);
|
||||
|
||||
public GenerateJob() {
|
||||
super("Generate Job");
|
||||
super("Generate Case");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -371,81 +384,100 @@ public class GenerateCaseDlg extends CaveSWTDialog {
|
|||
|
||||
setStateLbl("Creating: " + caseDir.getName(),
|
||||
caseDir.getAbsolutePath());
|
||||
ICaseCopy caseCopy = null;
|
||||
|
||||
String errorMessage = null;
|
||||
if (caseDir.exists()) {
|
||||
setStateLbl("Case exists: " + caseName,
|
||||
caseDir.getAbsolutePath());
|
||||
errorMessage = "Case exists: " + caseDir.getName();
|
||||
} else if (!caseDir.mkdirs()) {
|
||||
errorMessage = "Unable to create case: " + caseDir.getName();
|
||||
}
|
||||
|
||||
if (errorMessage != null) {
|
||||
setStateLbl(errorMessage, caseDir.getAbsolutePath());
|
||||
setProgressBar(100, SWT.ERROR);
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
|
||||
if (!caseDir.mkdirs()) {
|
||||
setStateLbl("Unable to create case: " + caseName,
|
||||
caseDir.getAbsolutePath());
|
||||
setProgressBar(100, SWT.ERROR);
|
||||
if (shutdown.get()) {
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
|
||||
if (shutdown) {
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
String currentArchive = null;
|
||||
String currentCategory = null;
|
||||
boolean updateDestDir = false;
|
||||
|
||||
for (DisplayData displayData : sourceDataList) {
|
||||
if (shutdown) {
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
|
||||
setStateLbl(
|
||||
"Copying \"" + displayData.getDisplayLabel() + "\"",
|
||||
null);
|
||||
String rootDir = displayData.getRootDir();
|
||||
int beginIndex = rootDir.length();
|
||||
|
||||
List<File> files = archiveManager.getDisplayFiles(displayData,
|
||||
startCal, endCal);
|
||||
for (File source : files) {
|
||||
if (shutdown) {
|
||||
try {
|
||||
for (DisplayData displayData : sourceDataList) {
|
||||
if (shutdown.get()) {
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
|
||||
String name = source.getAbsolutePath();
|
||||
String relativePath = name.substring(beginIndex);
|
||||
if (!displayData.getArchiveName().equals(currentArchive)) {
|
||||
updateDestDir = true;
|
||||
currentArchive = displayData.getArchiveName();
|
||||
currentCategory = displayData.getCategoryName();
|
||||
} else if (!displayData.getCategoryName().equals(
|
||||
currentCategory)) {
|
||||
updateDestDir = true;
|
||||
currentCategory = displayData.getCategoryName();
|
||||
}
|
||||
|
||||
setStateLbl("Copy: " + relativePath, name);
|
||||
File destination = new File(caseDir, relativePath);
|
||||
try {
|
||||
if (source.isDirectory()) {
|
||||
destination.mkdirs();
|
||||
FileUtil.copyDirectory(source, destination);
|
||||
if (updateDestDir) {
|
||||
updateDestDir = false;
|
||||
if (caseCopy != null) {
|
||||
caseCopy.finishCase();
|
||||
} else {
|
||||
File destParent = destination.getParentFile();
|
||||
destParent.mkdirs();
|
||||
FileUtil.copyFile(source, destination);
|
||||
if (!doCompress) {
|
||||
caseCopy = new CopyMove();
|
||||
} else if (doMultiFiles) {
|
||||
caseCopy = new CompressAndSplitCopy();
|
||||
} else {
|
||||
caseCopy = new CompressCopy();
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
caseCopy.startCase(caseDir, displayData, shutdown);
|
||||
setStateLbl(currentArchive + " | " + currentCategory,
|
||||
caseDir.getAbsolutePath() + "\n"
|
||||
+ currentArchive + "\n"
|
||||
+ currentCategory);
|
||||
}
|
||||
|
||||
List<File> files = archiveManager.getDisplayFiles(
|
||||
displayData, startCal, endCal);
|
||||
for (File source : files) {
|
||||
if (shutdown.get()) {
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
|
||||
caseCopy.copy(source);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (caseCopy != null) {
|
||||
caseCopy.finishCase();
|
||||
}
|
||||
caseCopy = null;
|
||||
|
||||
if (!doCompress) {
|
||||
setProgressBar(100, SWT.NORMAL);
|
||||
setStateLbl("Created: " + caseName, caseDir.getAbsolutePath());
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
|
||||
if (shutdown) {
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
|
||||
if (doMultiFiles) {
|
||||
setProgressBar(100, SWT.NORMAL);
|
||||
String message = "Compress into multifiles NYI.";
|
||||
setStateLbl(message, null);
|
||||
} else {
|
||||
setProgressBar(100, SWT.NORMAL);
|
||||
String message = "Compress into one file NYI";
|
||||
setStateLbl(message, null);
|
||||
|
||||
} catch (CaseCreateException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||
e);
|
||||
setStateLbl(
|
||||
"Failed to Create: " + caseName,
|
||||
caseDir.getAbsolutePath() + "\n"
|
||||
+ e.getLocalizedMessage());
|
||||
setProgressBar(100, SWT.ERROR);
|
||||
} finally {
|
||||
if (caseCopy != null) {
|
||||
try {
|
||||
caseCopy.finishCase();
|
||||
} catch (CaseCreateException ex) {
|
||||
// Ignore
|
||||
}
|
||||
caseCopy = null;
|
||||
}
|
||||
}
|
||||
|
||||
return Status.OK_STATUS;
|
||||
|
@ -458,8 +490,588 @@ public class GenerateCaseDlg extends CaveSWTDialog {
|
|||
*/
|
||||
@Override
|
||||
protected void canceling() {
|
||||
shutdown = true;
|
||||
shutdown.set(true);
|
||||
generateJob = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This class copies selected files/directories to a case-directory/archive.
|
||||
*/
|
||||
private static class CopyMove implements ICaseCopy {
|
||||
/**
|
||||
* Flag to indicate user canceled the case generation.
|
||||
*/
|
||||
private AtomicBoolean shutdown;
|
||||
|
||||
/**
|
||||
* Top destination directory to move files/dirctories to.
|
||||
*/
|
||||
private File destDir;
|
||||
|
||||
/**
|
||||
* Index on source Files where relative path starts.
|
||||
*/
|
||||
private int startRelativePath;
|
||||
|
||||
/**
|
||||
* Copy source File to desired destination.
|
||||
*
|
||||
* @param source
|
||||
* @param destination
|
||||
* @throws IOException
|
||||
*/
|
||||
private void copyFile(File source, File destination) throws IOException {
|
||||
if (shutdown.get()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (source.isDirectory()) {
|
||||
|
||||
if (!destination.exists()) {
|
||||
destination.mkdir();
|
||||
}
|
||||
|
||||
String[] files = source.list();
|
||||
|
||||
for (String file : files) {
|
||||
copyFile(new File(source, file),
|
||||
new File(destination, file));
|
||||
}
|
||||
} else {
|
||||
FileUtil.copyFile(source, destination);
|
||||
destination.setLastModified(source.lastModified());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copy(File source) throws CaseCreateException {
|
||||
String relativePath = source.getAbsolutePath().substring(
|
||||
startRelativePath);
|
||||
File destination = new File(destDir, relativePath);
|
||||
try {
|
||||
destination.getParentFile().mkdirs();
|
||||
copyFile(source, destination);
|
||||
} catch (IOException ex) {
|
||||
throw new CaseCreateException("CopyMove.copy: ", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startCase(File caseDir, DisplayData displayData,
|
||||
AtomicBoolean shutdown) {
|
||||
this.shutdown = shutdown;
|
||||
String archiveDirName = ArchiveConstants
|
||||
.convertToFileName(displayData.getArchiveName());
|
||||
destDir = new File(caseDir, archiveDirName);
|
||||
destDir.mkdirs();
|
||||
startRelativePath = displayData.getRootDir().length();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishCase() {
|
||||
// Nothing to do.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This class takes selected directories/files to
|
||||
* case-directory/archive/compress-category-file. The compress-category-file
|
||||
* is a tar gzip file containing the categorie's data.
|
||||
*/
|
||||
private static class CompressCopy implements ICaseCopy {
|
||||
/**
|
||||
* Flag to indicate user canceled case generation.
|
||||
*/
|
||||
private AtomicBoolean shutdown;
|
||||
|
||||
/**
|
||||
* Top Level destination directory.
|
||||
*/
|
||||
private File destDir;
|
||||
|
||||
/**
|
||||
* Stream to the file being created.
|
||||
*/
|
||||
private FileOutputStream fileStream;
|
||||
|
||||
/**
|
||||
* Stream to perform the compression.
|
||||
*/
|
||||
private GZIPOutputStream zipStream;
|
||||
|
||||
/**
|
||||
* Stream to create the tar image.
|
||||
*/
|
||||
private ArchiveOutputStream tarStream;
|
||||
|
||||
/**
|
||||
* Index to start of relative path in source File.
|
||||
*/
|
||||
private int startRelativePath;
|
||||
|
||||
/**
|
||||
* Directories already created in the tar image.
|
||||
*/
|
||||
private final HashSet<File> tarDirFile = new HashSet<File>();
|
||||
|
||||
/**
|
||||
* Buffer to use for reading in a file.
|
||||
*/
|
||||
private final byte[] buffer = new byte[(int) (32 * FileUtils.ONE_KB)];
|
||||
|
||||
@Override
|
||||
public void copy(File source) throws CaseCreateException {
|
||||
try {
|
||||
addParentDir(source);
|
||||
addTarFiles(new File[] { source });
|
||||
} catch (IOException e) {
|
||||
throw new CaseCreateException("Compress Copy failed: ", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add list of Files to the tar image.
|
||||
*
|
||||
* @param files
|
||||
* @throws IOException
|
||||
*/
|
||||
private void addTarFiles(File[] files) throws IOException {
|
||||
for (File file : files) {
|
||||
if (shutdown.get()) {
|
||||
return;
|
||||
}
|
||||
String name = file.getAbsolutePath().substring(
|
||||
startRelativePath);
|
||||
if (file.isDirectory()) {
|
||||
if (!tarDirFile.contains(file)) {
|
||||
TarArchiveEntry entry = new TarArchiveEntry(file, name);
|
||||
tarStream.putArchiveEntry(entry);
|
||||
tarStream.closeArchiveEntry();
|
||||
tarDirFile.add(file);
|
||||
addTarFiles(file.listFiles());
|
||||
}
|
||||
} else {
|
||||
TarArchiveEntry entry = new TarArchiveEntry(file, name);
|
||||
entry.setSize(file.length());
|
||||
FileInputStream fileStream = null;
|
||||
tarStream.putArchiveEntry(entry);
|
||||
try {
|
||||
fileStream = new FileInputStream(file);
|
||||
int len;
|
||||
while ((len = fileStream.read(buffer)) != -1) {
|
||||
tarStream.write(buffer, 0, len);
|
||||
}
|
||||
} finally {
|
||||
if (fileStream != null) {
|
||||
closeStream(fileStream);
|
||||
}
|
||||
}
|
||||
|
||||
tarStream.closeArchiveEntry();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convince method to close a steam and ignore any IOException.
|
||||
*
|
||||
* @param stream
|
||||
*/
|
||||
private void closeStream(Closeable stream) {
|
||||
try {
|
||||
stream.close();
|
||||
} catch (IOException ex) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If needed add parent directories to the tar image.
|
||||
*
|
||||
* @param file
|
||||
* @throws IOException
|
||||
*/
|
||||
private void addParentDir(File file) throws IOException {
|
||||
File parent = file.getParentFile();
|
||||
if (parent != null && !tarDirFile.contains(parent)
|
||||
&& (parent.getAbsolutePath().length() > startRelativePath)) {
|
||||
addParentDir(parent);
|
||||
String name = parent.getAbsolutePath().substring(
|
||||
startRelativePath);
|
||||
TarArchiveEntry entry = new TarArchiveEntry(parent, name);
|
||||
tarStream.putArchiveEntry(entry);
|
||||
tarStream.closeArchiveEntry();
|
||||
tarDirFile.add(parent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startCase(File caseDir, DisplayData displayData,
|
||||
AtomicBoolean shutdown) throws CaseCreateException {
|
||||
try {
|
||||
this.shutdown = shutdown;
|
||||
String archiveDirName = ArchiveConstants
|
||||
.convertToFileName(displayData.getArchiveName());
|
||||
String categoryDirName = ArchiveConstants
|
||||
.convertToFileName(displayData.getCategoryName());
|
||||
destDir = new File(caseDir, archiveDirName);
|
||||
destDir.mkdirs();
|
||||
tarDirFile.clear();
|
||||
startRelativePath = displayData.getRootDir().length();
|
||||
File tarFile = new File(destDir, categoryDirName
|
||||
+ ArchiveConstants.TAR_EXTENSION);
|
||||
fileStream = new FileOutputStream(tarFile);
|
||||
zipStream = new GZIPOutputStream(fileStream);
|
||||
ArchiveStreamFactory factory = new ArchiveStreamFactory();
|
||||
tarStream = factory.createArchiveOutputStream(
|
||||
ArchiveStreamFactory.TAR, zipStream);
|
||||
if (tarStream instanceof TarArchiveOutputStream) {
|
||||
((TarArchiveOutputStream) tarStream)
|
||||
.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new CaseCreateException("CompressCopy.startCase: ", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishCase() throws CaseCreateException {
|
||||
try {
|
||||
if (tarStream != null) {
|
||||
tarStream.finish();
|
||||
}
|
||||
if (zipStream != null) {
|
||||
zipStream.finish();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new CaseCreateException("CaseCopy.finish: ", e);
|
||||
} finally {
|
||||
if (tarStream != null) {
|
||||
closeStream(tarStream);
|
||||
} else if (zipStream != null) {
|
||||
closeStream(zipStream);
|
||||
} else if (fileStream != null) {
|
||||
closeStream(fileStream);
|
||||
}
|
||||
tarStream = null;
|
||||
zipStream = null;
|
||||
fileStream = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This class intended for making "image" files read for burning to a CD or
|
||||
* DVD. Need to resolve issues on how this should be done.
|
||||
*/
|
||||
private static class CompressAndSplitCopy implements ICaseCopy {
|
||||
|
||||
public void startCase(File caseDir, DisplayData displayData,
|
||||
AtomicBoolean shutdown) throws CaseCreateException {
|
||||
throw new CaseCreateException(
|
||||
"Compress and split not yet implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copy(File source) throws CaseCreateException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishCase() {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
// TODO Example code for future implementation of this class.
|
||||
// Will need to break up into the starCase, copy and finishCase will
|
||||
// need close and join.
|
||||
|
||||
// private void compressAndSplitCase() {
|
||||
// ArchiveOutputStream tarStream = null;
|
||||
// GZIPOutputStream zipStream = null;
|
||||
// try {
|
||||
// Pipe pipe = Pipe.open();
|
||||
// OutputStream poStream = Channels.newOutputStream(pipe.sink());
|
||||
// zipStream = new GZIPOutputStream(poStream);
|
||||
// ArchiveStreamFactory factory = new ArchiveStreamFactory();
|
||||
//
|
||||
// tarStream = factory.createArchiveOutputStream(
|
||||
// ArchiveStreamFactory.TAR, zipStream);
|
||||
//
|
||||
// if (tarStream instanceof TarArchiveOutputStream) {
|
||||
// ((TarArchiveOutputStream) tarStream)
|
||||
// .setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);
|
||||
// }
|
||||
//
|
||||
// final InputStream piStream = Channels.newInputStream(pipe
|
||||
// .source());
|
||||
// splitDone.set(false);
|
||||
//
|
||||
// Job splitJob = new Job("Split") {
|
||||
//
|
||||
// @Override
|
||||
// protected IStatus run(IProgressMonitor monitor) {
|
||||
// OutputStream splitStream = null;
|
||||
// long totSize = 0;
|
||||
// try {
|
||||
// byte[] buffer = new byte[12 * 1024];
|
||||
//
|
||||
// int bufCnt = 0;
|
||||
// long splitCnt = 0L;
|
||||
// while ((bufCnt = piStream.read(buffer)) != -1) {
|
||||
// totSize += bufCnt;
|
||||
// if (splitStream == null) {
|
||||
// splitStream = openSplitFile(++numSplitFiles);
|
||||
// }
|
||||
// long fileSize = splitCnt + bufCnt;
|
||||
// if (fileSize < splitSize) {
|
||||
// splitStream.write(buffer, 0, bufCnt);
|
||||
// splitCnt = fileSize;
|
||||
// } else if (fileSize == splitSize) {
|
||||
// splitStream.write(buffer, 0, bufCnt);
|
||||
// splitStream.close();
|
||||
// splitStream = null;
|
||||
// splitCnt = 0L;
|
||||
// } else {
|
||||
// int cnt = (int) (splitSize - splitCnt);
|
||||
// splitStream.write(buffer, 0, cnt);
|
||||
// splitStream.close();
|
||||
// splitStream = openSplitFile(++numSplitFiles);
|
||||
// int remainder = bufCnt - cnt;
|
||||
// splitStream.write(buffer, cnt, remainder);
|
||||
// splitCnt = remainder;
|
||||
// }
|
||||
// }
|
||||
// } catch (IOException e) {
|
||||
// statusHandler.handle(Priority.PROBLEM,
|
||||
// e.getLocalizedMessage(), e);
|
||||
// } finally {
|
||||
// if (splitStream != null) {
|
||||
// try {
|
||||
// splitStream.close();
|
||||
// } catch (IOException e) {
|
||||
// // Ignore
|
||||
// }
|
||||
// }
|
||||
// splitDone.set(true);
|
||||
// System.out.println("totalSize: " + totSize
|
||||
// + ", splitSize: " + splitSize
|
||||
// + ", numSplitFiles: " + numSplitFiles);
|
||||
// }
|
||||
//
|
||||
// return Status.OK_STATUS;
|
||||
// }
|
||||
// };
|
||||
// splitJob.schedule();
|
||||
//
|
||||
// createTarFile(tarStream, caseDir.listFiles());
|
||||
// tarStream.finish();
|
||||
// zipStream.finish();
|
||||
// try {
|
||||
// tarStream.close();
|
||||
// } catch (IOException ex) {
|
||||
// // Ignore
|
||||
// }
|
||||
// tarStream = null;
|
||||
//
|
||||
// try {
|
||||
// zipStream.close();
|
||||
// } catch (IOException ex) {
|
||||
// // Ignore
|
||||
// }
|
||||
// zipStream = null;
|
||||
//
|
||||
// while (!splitDone.get()) {
|
||||
// if (splitJob.getState() == Job.RUNNING) {
|
||||
// try {
|
||||
// System.out.println("splitJob.join()");
|
||||
// splitJob.join();
|
||||
// } catch (InterruptedException e) {
|
||||
// statusHandler.handle(Priority.INFO,
|
||||
// e.getLocalizedMessage(), e);
|
||||
// }
|
||||
// } else {
|
||||
// try {
|
||||
// private void compressAndSplitCase() {
|
||||
// ArchiveOutputStream tarStream = null;
|
||||
// GZIPOutputStream zipStream = null;
|
||||
// try {
|
||||
// Pipe pipe = Pipe.open();
|
||||
// OutputStream poStream = Channels.newOutputStream(pipe.sink());
|
||||
// zipStream = new GZIPOutputStream(poStream);
|
||||
// ArchiveStreamFactory factory = new ArchiveStreamFactory();
|
||||
//
|
||||
// tarStream = factory.createArchiveOutputStream(
|
||||
// ArchiveStreamFactory.TAR, zipStream);
|
||||
//
|
||||
// if (tarStream instanceof TarArchiveOutputStream) {
|
||||
// ((TarArchiveOutputStream) tarStream)
|
||||
// .setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);
|
||||
// }
|
||||
//
|
||||
// final InputStream piStream = Channels.newInputStream(pipe
|
||||
// .source());
|
||||
// splitDone.set(false);
|
||||
//
|
||||
// Job splitJob = new Job("Split") {
|
||||
//
|
||||
// @Override
|
||||
// protected IStatus run(IProgressMonitor monitor) {
|
||||
// OutputStream splitStream = null;
|
||||
// long totSize = 0;
|
||||
// try {
|
||||
// byte[] buffer = new byte[12 * 1024];
|
||||
//
|
||||
// int bufCnt = 0;
|
||||
// long splitCnt = 0L;
|
||||
// while ((bufCnt = piStream.read(buffer)) != -1) {
|
||||
// totSize += bufCnt;
|
||||
// if (splitStream == null) {
|
||||
// splitStream = openSplitFile(++numSplitFiles);
|
||||
// }
|
||||
// long fileSize = splitCnt + bufCnt;
|
||||
// if (fileSize < splitSize) {
|
||||
// splitStream.write(buffer, 0, bufCnt);
|
||||
// splitCnt = fileSize;
|
||||
// } else if (fileSize == splitSize) {
|
||||
// splitStream.write(buffer, 0, bufCnt);
|
||||
// splitStream.close();
|
||||
// splitStream = null;
|
||||
// splitCnt = 0L;
|
||||
// } else {
|
||||
// int cnt = (int) (splitSize - splitCnt);
|
||||
// splitStream.write(buffer, 0, cnt);
|
||||
// splitStream.close();
|
||||
// splitStream = openSplitFile(++numSplitFiles);
|
||||
// int remainder = bufCnt - cnt;
|
||||
// splitStream.write(buffer, cnt, remainder);
|
||||
// splitCnt = remainder;
|
||||
// }
|
||||
// }
|
||||
// } catch (IOException e) {
|
||||
// statusHandler.handle(Priority.PROBLEM,
|
||||
// e.getLocalizedMessage(), e);
|
||||
// } finally {
|
||||
// if (splitStream != null) {
|
||||
// try {
|
||||
// splitStream.close();
|
||||
// } catch (IOException e) {
|
||||
// // Ignore
|
||||
// }
|
||||
// }
|
||||
// splitDone.set(true);
|
||||
// System.out.println("totalSize: " + totSize
|
||||
// + ", splitSize: " + splitSize
|
||||
// + ", numSplitFiles: " + numSplitFiles);
|
||||
// }
|
||||
//
|
||||
// return Status.OK_STATUS;
|
||||
// }
|
||||
// };
|
||||
// splitJob.schedule();
|
||||
//
|
||||
// createTarFile(tarStream, caseDir.listFiles());
|
||||
// tarStream.finish();
|
||||
// zipStream.finish();
|
||||
// try {
|
||||
// tarStream.close();
|
||||
// } catch (IOException ex) {
|
||||
// // Ignore
|
||||
// }
|
||||
// tarStream = null;
|
||||
//
|
||||
// try {
|
||||
// zipStream.close();
|
||||
// } catch (IOException ex) {
|
||||
// // Ignore
|
||||
// }
|
||||
// zipStream = null;
|
||||
//
|
||||
// while (!splitDone.get()) {
|
||||
// if (splitJob.getState() == Job.RUNNING) {
|
||||
// try {
|
||||
// System.out.println("splitJob.join()");
|
||||
// splitJob.join();
|
||||
// } catch (InterruptedException e) {
|
||||
// statusHandler.handle(Priority.INFO,
|
||||
// e.getLocalizedMessage(), e);
|
||||
// }
|
||||
// } else {
|
||||
// try {
|
||||
// Thread.sleep(200L);
|
||||
// } catch (InterruptedException e) {
|
||||
// statusHandler.handle(Priority.INFO,
|
||||
// e.getLocalizedMessage(), e);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } catch (IOException e) {
|
||||
// statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||
// e);
|
||||
// } catch (ArchiveException e1) {
|
||||
// statusHandler.handle(Priority.PROBLEM,
|
||||
// e1.getLocalizedMessage(), e1);
|
||||
// } finally {
|
||||
// if (tarStream != null) {
|
||||
// try {
|
||||
// tarStream.close();
|
||||
// } catch (IOException e) {
|
||||
// // Ignore
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (zipStream != null) {
|
||||
// try {
|
||||
// zipStream.close();
|
||||
// } catch (IOException e) {
|
||||
// // Ignore
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// setProgressBar(100, SWT.NORMAL);
|
||||
// deleteCaseDir();
|
||||
// String message = caseDir.getName() + "split into " + numSplitFiles
|
||||
// + " file(s).";
|
||||
// setStateLbl(message, null);
|
||||
// }
|
||||
// Thread.sleep(200L);
|
||||
// } catch (InterruptedException e) {
|
||||
// statusHandler.handle(Priority.INFO,
|
||||
// e.getLocalizedMessage(), e);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } catch (IOException e) {
|
||||
// statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||
// e);
|
||||
// } catch (ArchiveException e1) {
|
||||
// statusHandler.handle(Priority.PROBLEM,
|
||||
// e1.getLocalizedMessage(), e1);
|
||||
// } finally {
|
||||
// if (tarStream != null) {
|
||||
// try {
|
||||
// tarStream.close();
|
||||
// } catch (IOException e) {
|
||||
// // Ignore
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (zipStream != null) {
|
||||
// try {
|
||||
// zipStream.close();
|
||||
// } catch (IOException e) {
|
||||
// // Ignore
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// setProgressBar(100, SWT.NORMAL);
|
||||
// deleteCaseDir();
|
||||
// String message = caseDir.getName() + "split into " + numSplitFiles
|
||||
// + " file(s).";
|
||||
// setStateLbl(message, null);
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,18 +17,17 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.archive.data;
|
||||
package com.raytheon.uf.viz.archive.ui;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
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.
|
||||
* Interface for copying source files/directories to the desired type of
|
||||
* destination.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -36,7 +35,7 @@ import com.raytheon.uf.common.archive.config.DisplayData;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 15, 2013 1966 rferrel Initial creation
|
||||
* Aug 21, 2013 2225 rferrel Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -44,39 +43,34 @@ import com.raytheon.uf.common.archive.config.DisplayData;
|
|||
* @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;
|
||||
public interface ICaseCopy {
|
||||
|
||||
/**
|
||||
* Create and entry and place it on the queue.
|
||||
* Prepare copier for sending display data's archive and category
|
||||
* selections.
|
||||
*
|
||||
* @param caseDir
|
||||
* - top level case directory file
|
||||
* @param displayData
|
||||
* @param startCal
|
||||
* @param endCal
|
||||
* - data preparing to move
|
||||
* @param shutdown
|
||||
* - Flag to check for orderly shudown
|
||||
* @throws CaseCreateException
|
||||
*/
|
||||
public SizeJobRequest(DisplayData displayData, Calendar startCal,
|
||||
Calendar endCal) {
|
||||
this.displayData = displayData;
|
||||
this.startCal = startCal;
|
||||
this.endCal = endCal;
|
||||
}
|
||||
public void startCase(File caseDir, DisplayData displayData,
|
||||
AtomicBoolean shutdown) throws CaseCreateException;
|
||||
|
||||
/**
|
||||
* A source to copy.
|
||||
*
|
||||
* @return displayData
|
||||
* @param source
|
||||
* @throws IOException
|
||||
*/
|
||||
public DisplayData getDisplayData() {
|
||||
return displayData;
|
||||
}
|
||||
public void copy(File source) throws CaseCreateException;
|
||||
|
||||
/**
|
||||
* Finish the move process for the current archive and category.
|
||||
*
|
||||
*/
|
||||
public void finishCase() throws CaseCreateException;
|
||||
}
|
|
@ -17,7 +17,31 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.archive.ui;
|
||||
|
||||
/**
|
||||
* Contains utility classes for mesowest plugin
|
||||
* Interface to adjusting values based on the retention hour value found in a
|
||||
* selection configuration.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 13, 2013 2220 rferrel Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author rferrel
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.raytheon.edex.plugin.obs.mesowest.util;
|
||||
|
||||
public interface IRetentionHour {
|
||||
/**
|
||||
* Adjust start/end based on the value found in selection configuration.
|
||||
*
|
||||
* @param startRetentionHours
|
||||
*/
|
||||
public void setRetentionTimes(long startRetentionHours);
|
||||
}
|
|
@ -50,6 +50,8 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
|||
* 7/1/06 chammack Initial Creation.
|
||||
* Sep 12, 2012 1167 djohnson Add datadelivery servers.
|
||||
* Jan 14, 2013 1469 bkowal Removed the hdf5 data directory.
|
||||
* Aug 27, 2013 2295 bkowal Removed the jms server property; added
|
||||
* jms connection string
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -70,16 +72,10 @@ public final class VizApp {
|
|||
|
||||
private static String httpServer;
|
||||
|
||||
private static String jmsServer;
|
||||
private static String jmsConnectionString;
|
||||
|
||||
private static String pypiesServer;
|
||||
|
||||
private static String dataDeliveryServer;
|
||||
|
||||
private static String dataDeliveryLcmServer;
|
||||
|
||||
private static String dataDeliveryQueryServer;
|
||||
|
||||
static {
|
||||
ManagementFactory.getRuntimeMXBean().getName();
|
||||
}
|
||||
|
@ -240,12 +236,12 @@ public final class VizApp {
|
|||
VizApp.httpServer = System.getProperty("awips.httpServer", httpServer);
|
||||
}
|
||||
|
||||
public static String getJmsServer() {
|
||||
return jmsServer;
|
||||
public static String getJmsConnectionString() {
|
||||
return jmsConnectionString;
|
||||
}
|
||||
|
||||
public static void setJmsServer(String jmsServer) {
|
||||
VizApp.jmsServer = jmsServer;
|
||||
public static void setJmsConnectionString(String jmsConnectionString) {
|
||||
VizApp.jmsConnectionString = jmsConnectionString;
|
||||
}
|
||||
|
||||
public static String getPypiesServer() {
|
||||
|
|
|
@ -20,14 +20,13 @@
|
|||
|
||||
package com.raytheon.uf.viz.core.comm;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
import javax.jms.ConnectionFactory;
|
||||
|
||||
import org.apache.qpid.client.AMQConnectionFactory;
|
||||
import org.apache.qpid.url.URLSyntaxException;
|
||||
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
|
||||
/**
|
||||
|
@ -43,16 +42,23 @@ import com.raytheon.uf.viz.core.VizApp;
|
|||
* Nov 2, 2011 #7391 bkowal Ensure that the generated WsId is properly formatted to be
|
||||
* included in a url.
|
||||
* May 09, 2013 1814 rjpeter Updated prefetch to 10.
|
||||
* Aug 27, 2013 2295 bkowal The entire connection string is now provided by EDEX; so, it
|
||||
* no longer needs to be constructed. Replaced stacktrace
|
||||
* printing with UFStatus.
|
||||
* </pre>
|
||||
*
|
||||
* @author chammack
|
||||
* @version 1.0
|
||||
*/
|
||||
public class JMSConnection {
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(JMSConnection.class);
|
||||
|
||||
private static final String WSID_PLACEHOLDER = "__WSID__";
|
||||
|
||||
private static JMSConnection instance;
|
||||
|
||||
private final String jndiProviderUrl;
|
||||
private final String connectionUrl;
|
||||
|
||||
private AMQConnectionFactory factory;
|
||||
|
||||
|
@ -65,38 +71,27 @@ public class JMSConnection {
|
|||
}
|
||||
|
||||
public JMSConnection() {
|
||||
this(VizApp.getJmsServer());
|
||||
this(VizApp.getJmsConnectionString());
|
||||
}
|
||||
|
||||
public JMSConnection(String jndiProviderUrl) {
|
||||
this.jndiProviderUrl = jndiProviderUrl;
|
||||
public JMSConnection(String connectionUrl) {
|
||||
this.connectionUrl = connectionUrl;
|
||||
try {
|
||||
// do not enable retry/connectdelay connection and factory will
|
||||
// silently reconnect and user will never be notified qpid is down
|
||||
// and cave/text workstation will just act like they are hung
|
||||
// up to each individual component that opens a connection to handle
|
||||
// reconnect
|
||||
this.factory = new AMQConnectionFactory(
|
||||
"amqp://guest:guest@"
|
||||
+ URLEncoder.encode(VizApp.getWsId().toString(),
|
||||
"UTF-8")
|
||||
+ "/edex?brokerlist='"
|
||||
+ this.jndiProviderUrl
|
||||
+ "?connecttimeout='5000'&heartbeat='0''&maxprefetch='10'&sync_publish='all'&failover='nofailover'");
|
||||
} catch (URLSyntaxException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (UnsupportedEncodingException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
String wsid = URLEncoder.encode(VizApp.getWsId().toString(),
|
||||
"UTF-8");
|
||||
this.factory = new AMQConnectionFactory(this.connectionUrl.replace(
|
||||
WSID_PLACEHOLDER, wsid));
|
||||
} catch (Exception e) {
|
||||
statusHandler.fatal("Failed to connect to the JMS Server!", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the jndiProviderUrl
|
||||
*
|
||||
* @return the jms connection url
|
||||
*/
|
||||
public String getJndiProviderUrl() {
|
||||
return jndiProviderUrl;
|
||||
public String getConnectionUrl() {
|
||||
return connectionUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -50,6 +50,8 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
|
|||
* Nov 5, 2009 mschenke Initial creation
|
||||
* Sep 12, 2012 1167 djohnson Add datadelivery servers.
|
||||
* Jan 14, 2013 1469 bkowal Removed the hdf5 data directory.
|
||||
* Aug 27, 2013 2295 bkowal The entire jms connection string is now
|
||||
* provided by EDEX.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -125,7 +127,7 @@ public class LocalizationInitializer {
|
|||
GetServersResponse resp = (GetServersResponse) ThriftClient
|
||||
.sendLocalizationRequest(req);
|
||||
VizApp.setHttpServer(resp.getHttpServer());
|
||||
VizApp.setJmsServer(resp.getJmsServer());
|
||||
VizApp.setJmsConnectionString(resp.getJmsConnectionString());
|
||||
VizApp.setPypiesServer(resp.getPypiesServer());
|
||||
VizServers.getInstance().setServerLocations(resp.getServerLocations());
|
||||
}
|
||||
|
|
|
@ -92,6 +92,8 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
|
|||
* May 19, 2007 #1127 randerso Implemented error handling
|
||||
* Sep 12, 2012 1167 djohnson Add datadelivery servers.
|
||||
* Jan 14, 2013 1469 bkowal Removed the hdf5 data directory.
|
||||
* Aug 27, 2013 2295 bkowal The entire jms connection string is now
|
||||
* provided by EDEX.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -147,8 +149,8 @@ public class LocalizationManager implements IPropertyChangeListener {
|
|||
this.overrideServer = false;
|
||||
this.overrideSite = false;
|
||||
try {
|
||||
localizationStore = new ScopedPreferenceStore(new InstanceScope(),
|
||||
"localization");
|
||||
localizationStore = new ScopedPreferenceStore(
|
||||
InstanceScope.INSTANCE, "localization");
|
||||
localizationStore.addPropertyChangeListener(this);
|
||||
loadHttpServer();
|
||||
loadAlertServer();
|
||||
|
@ -222,7 +224,7 @@ public class LocalizationManager implements IPropertyChangeListener {
|
|||
GetServersResponse resp = (GetServersResponse) ThriftClient
|
||||
.sendLocalizationRequest(req);
|
||||
VizApp.setHttpServer(resp.getHttpServer());
|
||||
VizApp.setJmsServer(resp.getJmsServer());
|
||||
VizApp.setJmsConnectionString(resp.getJmsConnectionString());
|
||||
VizApp.setPypiesServer(resp.getPypiesServer());
|
||||
VizServers.getInstance().setServerLocations(
|
||||
resp.getServerLocations());
|
||||
|
@ -910,40 +912,6 @@ public class LocalizationManager implements IPropertyChangeListener {
|
|||
return responses;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a request to the UtilitySrv
|
||||
*
|
||||
* @param request
|
||||
* the request to make
|
||||
* @return the responses from the request
|
||||
* @throws VizException
|
||||
*/
|
||||
private AbstractUtilityResponse[] makeRequest(
|
||||
PrivilegedUtilityRequestMessage request)
|
||||
throws LocalizationOpFailedException {
|
||||
|
||||
AbstractUtilityResponse[] responseList = null;
|
||||
|
||||
UtilityResponseMessage localizationResponse = null;
|
||||
try {
|
||||
localizationResponse = (UtilityResponseMessage) ThriftClient
|
||||
.sendLocalizationRequest(request);
|
||||
} catch (VizException e) {
|
||||
throw new LocalizationOpFailedException("Localization error", e);
|
||||
}
|
||||
if (localizationResponse != null) {
|
||||
responseList = localizationResponse.getResponses();
|
||||
|
||||
for (AbstractUtilityResponse response : responseList) {
|
||||
if (!response.successful()) {
|
||||
throw new LocalizationOpFailedException(
|
||||
response.getFormattedErrorMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
return responseList;
|
||||
}
|
||||
|
||||
public boolean isOverrideServer() {
|
||||
return overrideServer;
|
||||
}
|
||||
|
|
|
@ -32,15 +32,16 @@ import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
|||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 26, 2011 bsteffen Initial creation
|
||||
*
|
||||
* Jul 26, 2011 bsteffen Initial creation
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author bsteffen
|
||||
* @version 1.0
|
||||
*/
|
||||
|
@ -79,4 +80,8 @@ public class D2DNSharpDataObject extends PluginDataObject {
|
|||
this.layers = layers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "d2dnsharpdataobject";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1028,7 +1028,10 @@ in|.0394|.0| 4 | |f5.2|@.|8000F0FF| |13|\
|
|||
<styleRule>
|
||||
<paramLevelMatches>
|
||||
<parameter>TP24hr</parameter>
|
||||
<parameter>TP36hr</parameter>
|
||||
<parameter>TP36hr</parameter>
|
||||
<parameter>TP6hr_std</parameter>
|
||||
<parameter>TP6hr_avg</parameter>
|
||||
<parameter>TP24hr_avg</parameter>
|
||||
</paramLevelMatches>
|
||||
<contourStyle>
|
||||
<displayUnits>in</displayUnits>
|
||||
|
|
|
@ -61,7 +61,8 @@ import com.raytheon.uf.viz.monitor.scan.ScanMonitor;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 13, 2009 dhladky Initial creation
|
||||
* Feb 28, 2013 1731 bsteffen Optimize construction of scan resource.
|
||||
* Apr 18, 2013 1926 njensen Reuse URIs in construction of resource
|
||||
* Apr 18, 2013 1926 njensen Reuse URIs in construction of resource
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -203,7 +204,6 @@ public class ScanResourceData extends AbstractRequestableResourceData {
|
|||
public void populateRecords(ScanRecord[] records) throws VizException {
|
||||
Map<File, Set<ScanRecord>> fileMap = new HashMap<File, Set<ScanRecord>>();
|
||||
for (ScanRecord record : records) {
|
||||
record.setPluginName("scan");
|
||||
File loc = HDF5Util.findHDF5Location(record);
|
||||
Set<ScanRecord> recordSet = fileMap.get(loc);
|
||||
if (recordSet == null) {
|
||||
|
@ -260,12 +260,12 @@ public class ScanResourceData extends AbstractRequestableResourceData {
|
|||
List<DataTime> dataList = new ArrayList<DataTime>();
|
||||
|
||||
long[] times = monitor.getDMDMaxAngleTimes(icao);
|
||||
int index = times.length - 1 < 0 ? 0 : times.length - 1;
|
||||
int index = (times.length - 1) < 0 ? 0 : times.length - 1;
|
||||
if ((times != null) && (times.length != 0)) {
|
||||
for (int i = 0; i < allTimes.length; i++) {
|
||||
if (allTimes[i].getRefTime() != null) {
|
||||
if (allTimes[i].getRefTime().getTime() == times[index]) {
|
||||
dataList.add(allTimes[i]);
|
||||
for (DataTime allTime : allTimes) {
|
||||
if (allTime.getRefTime() != null) {
|
||||
if (allTime.getRefTime().getTime() == times[index]) {
|
||||
dataList.add(allTime);
|
||||
index--;
|
||||
if (index == -1) {
|
||||
break;
|
||||
|
|
|
@ -84,11 +84,11 @@ public class FSILauncherLayer extends
|
|||
|
||||
private MouseHandler mouseHandler;
|
||||
|
||||
private MenuManager quickMenuManager;
|
||||
private final MenuManager quickMenuManager;
|
||||
|
||||
private MenuManager fullMenuManager;
|
||||
private final MenuManager fullMenuManager;
|
||||
|
||||
private Shell shell;
|
||||
private final Shell shell;
|
||||
|
||||
public FSILauncherLayer(FSILauncherResourceData fsiLauncherResourceData,
|
||||
LoadProperties loadProperties) {
|
||||
|
@ -201,14 +201,16 @@ public class FSILauncherLayer extends
|
|||
} else {
|
||||
try {
|
||||
for (Object o : (ArrayList<?>) ((ResponseMessageGeneric) response)
|
||||
.getContents())
|
||||
.getContents()) {
|
||||
result.add((String) o);
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
throw new VizException("Unexpected server response", e);
|
||||
}
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
throw new VizException("Could not load getFsiRadars.py");
|
||||
}
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not retrieve FSI radar list", e);
|
||||
|
@ -229,15 +231,16 @@ public class FSILauncherLayer extends
|
|||
geoClickedPoint = getResourceContainer().translateClick(x, y);
|
||||
if (isEditable()) {
|
||||
// panelClickPoint = new Point(x, y);
|
||||
if (mouseButton == MOUSE_BUTTON_TO_USE)
|
||||
if (mouseButton == MOUSE_BUTTON_TO_USE) {
|
||||
clicked = true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleMouseUp(int x, int y, int mouseButton) {
|
||||
if (clicked && mouseButton == MOUSE_BUTTON_TO_USE) {
|
||||
if (clicked && (mouseButton == MOUSE_BUTTON_TO_USE)) {
|
||||
clicked = false;
|
||||
|
||||
/*
|
||||
|
@ -295,8 +298,9 @@ public class FSILauncherLayer extends
|
|||
throw new VizException("Unexpected server response", e);
|
||||
}
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
throw new VizException("Could not retrieve FSI environment");
|
||||
}
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not retrieve FSI radar list", e);
|
||||
|
@ -307,7 +311,7 @@ public class FSILauncherLayer extends
|
|||
|
||||
public class LaunchFSIAction extends Action {
|
||||
|
||||
private String radarName;
|
||||
private final String radarName;
|
||||
|
||||
private class StormVector {
|
||||
public boolean useSTI = true;
|
||||
|
@ -393,7 +397,8 @@ public class FSILauncherLayer extends
|
|||
RadarRecord radarRecord = null;
|
||||
try {
|
||||
List<Object[]> obs = query.performQuery();
|
||||
if (obs != null && !obs.isEmpty() && obs.get(0).length > 0) {
|
||||
if ((obs != null) && !obs.isEmpty()
|
||||
&& (obs.get(0).length > 0)) {
|
||||
radarRecord = (RadarRecord) obs.get(0)[0];
|
||||
} else {
|
||||
// default to 0.5 for non-terminal radars, test if
|
||||
|
@ -409,7 +414,6 @@ public class FSILauncherLayer extends
|
|||
} catch (RuntimeException e) {
|
||||
throw new VizException("Unexpected response format", e);
|
||||
}
|
||||
radarRecord.setPluginName("radar"); // TODO: huh?
|
||||
File loc = HDF5Util.findHDF5Location(radarRecord);
|
||||
IDataStore dataStore = DataStoreFactory.getDataStore(loc);
|
||||
try {
|
||||
|
@ -439,8 +443,9 @@ public class FSILauncherLayer extends
|
|||
|
||||
private String createControlMessage() {
|
||||
FSIEnvironment env = getFSIEnvironment();
|
||||
if (env == null)
|
||||
if (env == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// According to FSI_GUI, this must have the format ##.##
|
||||
String subTypeStr = String.format("%04.2f",
|
||||
|
@ -540,13 +545,14 @@ public class FSILauncherLayer extends
|
|||
@Override
|
||||
public void run() {
|
||||
String controlMessage = createControlMessage();
|
||||
if (controlMessage == null)
|
||||
if (controlMessage == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
File f = PathManagerFactory.getPathManager().getStaticFile(
|
||||
"fsi" + File.separator + FSI_START_SCRIPT_NAME);
|
||||
|
||||
if (f == null || !f.exists()) {
|
||||
if ((f == null) || !f.exists()) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not find the FSI start script.");
|
||||
return;
|
||||
|
@ -604,12 +610,14 @@ public class FSILauncherLayer extends
|
|||
int nLines = 0;
|
||||
while (true) {
|
||||
String s = br.readLine();
|
||||
if (s == null)
|
||||
if (s == null) {
|
||||
break;
|
||||
}
|
||||
sb.append(s);
|
||||
sb.append('\n');
|
||||
if (++nLines >= MAX_LINES)
|
||||
if (++nLines >= MAX_LINES) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace(System.err);
|
||||
|
@ -628,7 +636,7 @@ public class FSILauncherLayer extends
|
|||
statusHandler
|
||||
.handle(Priority.PROBLEM,
|
||||
"FSI failed to start: "
|
||||
+ sb.toString());
|
||||
+ sb.toString());
|
||||
return;
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
|
|
|
@ -35,7 +35,9 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
|
|||
import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Listens to changes to the "Disable JMS" option in the Thin Client
|
||||
* Preferences. Will automatically connect to and disconnect from the
|
||||
* JMS Server as the option is updated.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -44,6 +46,8 @@ import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 29, 2011 bsteffen Initial creation
|
||||
* Aug 27, 2013 2295 bkowal The entire jms connection string is now
|
||||
* provided by EDEX.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -96,13 +100,14 @@ public class ThinClientNotificationManagerJob extends NotificationManagerJob
|
|||
if (disableJMS) {
|
||||
disconnect(true);
|
||||
} else {
|
||||
if (VizApp.getJmsServer() == null) {
|
||||
if (VizApp.getJmsConnectionString() == null) {
|
||||
GetServersRequest req = new GetServersRequest();
|
||||
GetServersResponse resp;
|
||||
try {
|
||||
resp = (GetServersResponse) ThriftClient
|
||||
.sendLocalizationRequest(req);
|
||||
VizApp.setJmsServer(resp.getJmsServer());
|
||||
VizApp.setJmsConnectionString(resp
|
||||
.getJmsConnectionString());
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
|
|
|
@ -48,8 +48,10 @@ import com.raytheon.uf.viz.thinclient.ui.ThinClientConnectivityDialog;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 23, 2011 bsteffen Initial creation
|
||||
* Dec 06, 2012 1396 njensen Added setting VizServers
|
||||
* Dec 06, 2012 1396 njensen Added setting VizServers
|
||||
* Jan 14, 2013 1469 bkowal Removed setting the hdf5 data directory
|
||||
* Aug 27, 2013 2295 bkowal The entire jms connection string is
|
||||
* now provided by EDEX.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -92,7 +94,7 @@ public class ThinClientLocalizationInitializer extends LocalizationInitializer {
|
|||
GetServersResponse resp = (GetServersResponse) ThriftClient
|
||||
.sendLocalizationRequest(req);
|
||||
if (!disableJMS) {
|
||||
VizApp.setJmsServer(resp.getJmsServer());
|
||||
VizApp.setJmsConnectionString(resp.getJmsConnectionString());
|
||||
}
|
||||
}
|
||||
VizApp.setHttpServer(servicesProxy);
|
||||
|
@ -103,12 +105,13 @@ public class ThinClientLocalizationInitializer extends LocalizationInitializer {
|
|||
HttpClient.getInstance().setCompressRequests(compressRequests);
|
||||
|
||||
// use the proxy for all servers in VizServers
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, String> serversMap = new DefaultedMap(servicesProxy);
|
||||
VizServers.getInstance().setServerLocations(serversMap);
|
||||
} else {
|
||||
processGetServers();
|
||||
if (disableJMS) {
|
||||
VizApp.setJmsServer(null);
|
||||
VizApp.setJmsConnectionString(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1227,6 +1227,9 @@
|
|||
<parameter>TP48hr</parameter>
|
||||
<parameter>TPrun</parameter>
|
||||
<parameter>TP120hr</parameter>
|
||||
<parameter>TP6hr_std</parameter>
|
||||
<parameter>TP6hr_avg</parameter>
|
||||
<parameter>TP24hr_avg</parameter>
|
||||
</paramLevelMatches>
|
||||
<imageStyle>
|
||||
<!-- filterLow="true" -->
|
||||
|
|
|
@ -27,7 +27,6 @@ import javax.measure.unit.Unit;
|
|||
|
||||
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
|
||||
import com.raytheon.uf.common.comm.CommunicationException;
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridConstants;
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
|
||||
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
|
||||
import com.raytheon.uf.common.dataplugin.radar.RadarRecord;
|
||||
|
@ -57,7 +56,8 @@ import com.raytheon.viz.grid.util.SliceUtil;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 18, 2010 #4473 rjpeter Initial creation
|
||||
* Mar 18, 2010 4473 rjpeter Initial creation
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -69,9 +69,9 @@ public class RadarRequestableData extends GridRequestableData {
|
|||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(RadarRequestableData.class);
|
||||
|
||||
private RadarRecord radarSource;
|
||||
private final RadarRecord radarSource;
|
||||
|
||||
private RadarMapper tiler;
|
||||
private final RadarMapper tiler;
|
||||
|
||||
private WeakReference<FloatDataRecord> cache = null;
|
||||
|
||||
|
@ -107,7 +107,6 @@ public class RadarRequestableData extends GridRequestableData {
|
|||
Parameter parameter = new Parameter(parameterAbbrev,
|
||||
this.parameterName, unit);
|
||||
record.setParameter(parameter);
|
||||
record.setPluginName(GridConstants.GRID);
|
||||
record.setDataTime(source.getDataTime());
|
||||
record.constructDataURI();
|
||||
setGridSource(record);
|
||||
|
|
|
@ -58,7 +58,8 @@ import com.raytheon.viz.grid.util.RadarAdapter;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 25, 2010 bsteffen Initial creation
|
||||
* Mar 25, 2010 bsteffen Initial creation
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -88,9 +89,9 @@ public class GridUpdater implements IAlertObserver {
|
|||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + getOuterType().hashCode();
|
||||
result = prime * result + ((node == null) ? 0 : node.hashCode());
|
||||
result = prime * result + timeOffset;
|
||||
result = (prime * result) + getOuterType().hashCode();
|
||||
result = (prime * result) + ((node == null) ? 0 : node.hashCode());
|
||||
result = (prime * result) + timeOffset;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -101,22 +102,29 @@ public class GridUpdater implements IAlertObserver {
|
|||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
if (this == obj) {
|
||||
return true;
|
||||
if (obj == null)
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
UpdateValue other = (UpdateValue) obj;
|
||||
if (!getOuterType().equals(other.getOuterType()))
|
||||
if (!getOuterType().equals(other.getOuterType())) {
|
||||
return false;
|
||||
}
|
||||
if (node == null) {
|
||||
if (other.node != null)
|
||||
if (other.node != null) {
|
||||
return false;
|
||||
} else if (!node.equals(other.node))
|
||||
}
|
||||
} else if (!node.equals(other.node)) {
|
||||
return false;
|
||||
if (timeOffset != other.timeOffset)
|
||||
}
|
||||
if (timeOffset != other.timeOffset) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -126,11 +134,11 @@ public class GridUpdater implements IAlertObserver {
|
|||
|
||||
}
|
||||
|
||||
private Set<String> myUpdates = new HashSet<String>();
|
||||
private final Set<String> myUpdates = new HashSet<String>();
|
||||
|
||||
private GridInventory inventory;
|
||||
private final GridInventory inventory;
|
||||
|
||||
private Map<GridMapKey, Set<UpdateValue>> updateMap = new HashMap<GridMapKey, Set<UpdateValue>>();
|
||||
private final Map<GridMapKey, Set<UpdateValue>> updateMap = new HashMap<GridMapKey, Set<UpdateValue>>();
|
||||
|
||||
public GridUpdater(GridInventory inventory) {
|
||||
this.inventory = inventory;
|
||||
|
@ -147,7 +155,7 @@ public class GridUpdater implements IAlertObserver {
|
|||
public synchronized void addNode(AbstractDerivedDataNode node)
|
||||
throws VizException {
|
||||
List<Dependency> dependencies = node.getDependencies();
|
||||
if (dependencies == null || dependencies.isEmpty()) {
|
||||
if ((dependencies == null) || dependencies.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
List<Dependency> dep = new ArrayList<Dependency>(dependencies);
|
||||
|
@ -238,7 +246,7 @@ public class GridUpdater implements IAlertObserver {
|
|||
// Null means it is an alias model and supplement means
|
||||
// there exists a true GribNode buried under the or
|
||||
// node
|
||||
if (method == null
|
||||
if ((method == null)
|
||||
|| !method.getName().equals("Supplement")) {
|
||||
inventory.reinitTree();
|
||||
// System.out.println(((AbstractDerivedLevelNode) lNode)
|
||||
|
@ -256,7 +264,6 @@ public class GridUpdater implements IAlertObserver {
|
|||
}
|
||||
for (UpdateValue value : set) {
|
||||
GridRecord fakeRec = new GridRecord();
|
||||
fakeRec.setPluginName(GridInventory.PLUGIN_NAME);
|
||||
Object obj = alert.decodedAlert.get("dataTime");
|
||||
if (!(obj instanceof DataTime)) {
|
||||
throw new IllegalArgumentException(
|
||||
|
|
|
@ -38,7 +38,8 @@ import com.raytheon.viz.grid.util.RadarProductCodeMapping;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 20, 2012 bsteffen Initial creation
|
||||
* Sep 20, 2012 bsteffen Initial creation
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -77,33 +78,39 @@ public class RadarUpdater implements IAlertObserver {
|
|||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime
|
||||
* result
|
||||
result = (prime * result)
|
||||
+ ((elevationAngle == null) ? 0 : elevationAngle.hashCode());
|
||||
result = prime * result
|
||||
result = (prime * result)
|
||||
+ ((productCode == null) ? 0 : productCode.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
if (this == obj) {
|
||||
return true;
|
||||
if (obj == null)
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
CacheKey other = (CacheKey) obj;
|
||||
if (elevationAngle == null) {
|
||||
if (other.elevationAngle != null)
|
||||
if (other.elevationAngle != null) {
|
||||
return false;
|
||||
} else if (!elevationAngle.equals(other.elevationAngle))
|
||||
}
|
||||
} else if (!elevationAngle.equals(other.elevationAngle)) {
|
||||
return false;
|
||||
}
|
||||
if (productCode == null) {
|
||||
if (other.productCode != null)
|
||||
if (other.productCode != null) {
|
||||
return false;
|
||||
} else if (!productCode.equals(other.productCode))
|
||||
}
|
||||
} else if (!productCode.equals(other.productCode)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -122,7 +129,7 @@ public class RadarUpdater implements IAlertObserver {
|
|||
|
||||
}
|
||||
|
||||
private Map<CacheKey, CacheEntry> cache = new LinkedHashMap<CacheKey, CacheEntry>(
|
||||
private final Map<CacheKey, CacheEntry> cache = new LinkedHashMap<CacheKey, CacheEntry>(
|
||||
100, .75f, true) {
|
||||
|
||||
private static final long serialVersionUID = 2022670836957170184L;
|
||||
|
@ -152,14 +159,14 @@ public class RadarUpdater implements IAlertObserver {
|
|||
for (AlertMessage alertMessage : alertMessages) {
|
||||
String icao = alertMessage.decodedAlert
|
||||
.get(RadarAdapter.ICAO_QUERY).toString();
|
||||
if (icao == null
|
||||
if ((icao == null)
|
||||
|| !icao.equalsIgnoreCase(configuredRadar.getRdaId())) {
|
||||
continue;
|
||||
}
|
||||
globalTimes = null;
|
||||
Object obj = alertMessage.decodedAlert
|
||||
.get(RadarAdapter.PRODUCT_CODE_QUERY);
|
||||
if (obj == null || !(obj instanceof Integer)) {
|
||||
if ((obj == null) || !(obj instanceof Integer)) {
|
||||
continue;
|
||||
}
|
||||
Integer productCode = (Integer) obj;
|
||||
|
@ -169,12 +176,12 @@ public class RadarUpdater implements IAlertObserver {
|
|||
continue;
|
||||
}
|
||||
obj = alertMessage.decodedAlert.get("dataTime");
|
||||
if (obj == null || !(obj instanceof DataTime)) {
|
||||
if ((obj == null) || !(obj instanceof DataTime)) {
|
||||
continue;
|
||||
}
|
||||
DataTime time = (DataTime) obj;
|
||||
obj = alertMessage.decodedAlert.get(RadarAdapter.TILT_QUERY);
|
||||
if (obj == null || !(obj instanceof Double)) {
|
||||
if ((obj == null) || !(obj instanceof Double)) {
|
||||
continue;
|
||||
}
|
||||
Double elevationAngle = (Double) obj;
|
||||
|
@ -188,7 +195,6 @@ public class RadarUpdater implements IAlertObserver {
|
|||
e1.getLocalizedMessage(), e1);
|
||||
}
|
||||
GridRecord fakeRec = new GridRecord();
|
||||
fakeRec.setPluginName(GridInventory.PLUGIN_NAME);
|
||||
|
||||
fakeRec.setDataTime(time);
|
||||
fakeRec.setDatasetId(RadarAdapter.RADAR_SOURCE);
|
||||
|
@ -209,12 +215,12 @@ public class RadarUpdater implements IAlertObserver {
|
|||
private CacheKey getCacheKey(RadarRequestableLevelNode rNode) {
|
||||
Map<String, RequestConstraint> rcMap = rNode.getRequestConstraintMap();
|
||||
RequestConstraint rc = rcMap.get(RadarAdapter.PRODUCT_CODE_QUERY);
|
||||
if (rc == null || rc.getConstraintType() != ConstraintType.EQUALS) {
|
||||
if ((rc == null) || (rc.getConstraintType() != ConstraintType.EQUALS)) {
|
||||
return null;
|
||||
}
|
||||
Integer productCode = Integer.parseInt(rc.getConstraintValue());
|
||||
rc = rcMap.get(RadarAdapter.TILT_QUERY);
|
||||
if (rc == null || rc.getConstraintType() != ConstraintType.EQUALS) {
|
||||
if ((rc == null) || (rc.getConstraintType() != ConstraintType.EQUALS)) {
|
||||
return null;
|
||||
}
|
||||
Double elevationAngle = Double.parseDouble(rc.getConstraintValue());
|
||||
|
@ -232,7 +238,7 @@ public class RadarUpdater implements IAlertObserver {
|
|||
if (entry == null) {
|
||||
return null;
|
||||
}
|
||||
if (entry.insertTime + CACHE_TIME < System.currentTimeMillis()) {
|
||||
if ((entry.insertTime + CACHE_TIME) < System.currentTimeMillis()) {
|
||||
cache.remove(cacheKey);
|
||||
return null;
|
||||
}
|
||||
|
@ -248,7 +254,7 @@ public class RadarUpdater implements IAlertObserver {
|
|||
if (globalTimes == null) {
|
||||
return null;
|
||||
}
|
||||
if (globalInsertTime + CACHE_TIME < System.currentTimeMillis()) {
|
||||
if ((globalInsertTime + CACHE_TIME) < System.currentTimeMillis()) {
|
||||
globalTimes = null;
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.util.Collection;
|
|||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginException;
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridConstants;
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
|
||||
import com.raytheon.uf.common.datastorage.Request;
|
||||
import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
|
||||
|
@ -40,17 +39,18 @@ import com.raytheon.viz.grid.util.TiltRequest;
|
|||
/**
|
||||
* A PDO that extends GridRecord and wraps a AbstractRequestableData to allow
|
||||
* derived parameters to be used anywhere GridRecords can be used.
|
||||
*
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 18, 2010 bsteffen Initial creation
|
||||
* Mar 18, 2010 bsteffen Initial creation
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
*
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author bsteffen
|
||||
* @version 1.0
|
||||
*/
|
||||
|
@ -67,9 +67,10 @@ public class RequestableDataRecord extends GridRecord {
|
|||
GridCoverage coverage = null;
|
||||
if (requester.getSpace() instanceof GridCoverage) {
|
||||
coverage = (GridCoverage) requester.getSpace();
|
||||
if (requester instanceof GridRequestableData) {
|
||||
setSecondaryId(((GridRequestableData) requester).getGridSource().getSecondaryId());
|
||||
}
|
||||
if (requester instanceof GridRequestableData) {
|
||||
setSecondaryId(((GridRequestableData) requester)
|
||||
.getGridSource().getSecondaryId());
|
||||
}
|
||||
}
|
||||
setDatasetId(requester.getSource());
|
||||
setLocation(coverage);
|
||||
|
@ -78,7 +79,6 @@ public class RequestableDataRecord extends GridRecord {
|
|||
requester.getParameterName(), requester.getUnit());
|
||||
|
||||
setParameter(parameter);
|
||||
setPluginName(GridConstants.GRID);
|
||||
setDataTime(requester.getDataTime());
|
||||
try {
|
||||
constructDataURI();
|
||||
|
@ -142,7 +142,7 @@ public class RequestableDataRecord extends GridRecord {
|
|||
}
|
||||
}
|
||||
float[] data = new float[nx * ny];
|
||||
for (int i = 0; i < nx * ny; i++) {
|
||||
for (int i = 0; i < (nx * ny); i++) {
|
||||
data[i] = ((Number) obj).floatValue();
|
||||
}
|
||||
FloatDataRecord rec = new FloatDataRecord(this.getParameter()
|
||||
|
|
|
@ -136,7 +136,7 @@ import com.raytheon.uf.common.site.SiteMap;
|
|||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.time.SimulatedTime;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.edex.decodertools.time.TimeTools;
|
||||
import com.raytheon.uf.edex.services.textdbsrv.IQueryTransport;
|
||||
import com.raytheon.uf.edex.wmo.message.WMOHeader;
|
||||
|
@ -187,8 +187,6 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||
import com.raytheon.viz.ui.dialogs.SWTMessageBox;
|
||||
|
||||
// import com.raytheon.uf.viz.core.RGBColors;
|
||||
|
||||
/**
|
||||
* Main Text Editor dialog.
|
||||
*
|
||||
|
@ -322,15 +320,17 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox;
|
|||
* 31JAN2013 1568 rferrel Spell checker now tied to this dialog instead of parent.
|
||||
* 26Apr2013 16123 snaples Removed setFocus to TextEditor in postExecute method.
|
||||
* 07Jun2013 1981 mpduff Add user id to OUPRequest as it is now protected.
|
||||
* 20Jun2013 15733 XHuang Add functionalities that get Font size, Text colors from
|
||||
* *.xml files in localization;
|
||||
* add selection listener to catch the highlight words and
|
||||
* set the highlight colors.
|
||||
* 20Jun2013 15733 XHuang Add functionalities that get Font size, Text colors from
|
||||
* *.xml files in localization;
|
||||
* add selection listener to catch the highlight words and
|
||||
* set the highlight colors.
|
||||
* 23Jul2013 2176 jsanchez Added a new confirmation message for emergency warnings.
|
||||
* 25July2013 15733 GHull Read font and color prefs from TextEditorCfg.
|
||||
* 23Aug2013 DR 16514 D. Friedman Fix handling of completed product requests. Do not change
|
||||
* command history or close browser window for "update obs".
|
||||
* 04Sep2013 2176 jsanchez Changed the order of the QC check dialogs.
|
||||
* 12Sep2013 DR 2249 rferrel Change Time stamp in file name created by warngen to use
|
||||
* simulated time.
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
|
@ -378,8 +378,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
*/
|
||||
private static final int UPDATE_FG = SWT.COLOR_WHITE;
|
||||
|
||||
private final int HIGHLIGHT_BG = SWT.COLOR_RED;
|
||||
|
||||
/**
|
||||
* The length of BEGIN_ELEMENT_TAG.
|
||||
*/
|
||||
|
@ -1087,11 +1085,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
*/
|
||||
private SearchReplaceDlg searchReplaceDlg;
|
||||
|
||||
/**
|
||||
* Flag to indicate if the document being edited has been modified.
|
||||
*/
|
||||
private boolean dirty = false;
|
||||
|
||||
/**
|
||||
* Flag to indicate if the document being edited has been saved.
|
||||
*/
|
||||
|
@ -1504,7 +1497,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
return;
|
||||
}
|
||||
|
||||
if (afosBrowser != null
|
||||
if ((afosBrowser != null)
|
||||
&& afosBrowser.isAfosBrowserActive()) {
|
||||
afosBrowser.hide();
|
||||
displayAfosBrowser = true;
|
||||
|
@ -1629,7 +1622,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
|
||||
if (faxAllMsgDlg == null || faxAllMsgDlg.isDisposed()) {
|
||||
if ((faxAllMsgDlg == null) || faxAllMsgDlg.isDisposed()) {
|
||||
faxAllMsgDlg = new FaxMessageDlg(shell);
|
||||
faxAllMsgDlg.setInitialText(textEditor.getText());
|
||||
faxAllMsgDlg.open();
|
||||
|
@ -1644,7 +1637,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
faxSelectionItem.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
if (faxMsgDlg == null || faxMsgDlg.isDisposed()) {
|
||||
if ((faxMsgDlg == null) || faxMsgDlg.isDisposed()) {
|
||||
faxMsgDlg = new FaxMessageDlg(shell);
|
||||
faxMsgDlg.setInitialText(textEditor.getSelectionText());
|
||||
faxMsgDlg.open();
|
||||
|
@ -1659,7 +1652,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
configAutoFaxItem.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
if (ldadFaxSitesDlg == null || ldadFaxSitesDlg.isDisposed()) {
|
||||
if ((ldadFaxSitesDlg == null) || ldadFaxSitesDlg.isDisposed()) {
|
||||
ldadFaxSitesDlg = new LdadFaxSitesDlg(shell);
|
||||
ldadFaxSitesDlg.open();
|
||||
} else {
|
||||
|
@ -1947,7 +1940,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
searchItem.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
if (searchReplaceDlg == null || searchReplaceDlg.isDisposed()) {
|
||||
if ((searchReplaceDlg == null) || searchReplaceDlg.isDisposed()) {
|
||||
searchReplaceDlg = new SearchReplaceDlg(shell, textEditor,
|
||||
inEditMode);
|
||||
searchReplaceDlg.open();
|
||||
|
@ -2449,7 +2442,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2475,7 +2467,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
}
|
||||
|
||||
// skip any spaces at cursor
|
||||
while (text.charAt(searchOffset) == ' ' && searchOffset > 0) {
|
||||
while ((text.charAt(searchOffset) == ' ') && (searchOffset > 0)) {
|
||||
searchOffset--;
|
||||
}
|
||||
|
||||
|
@ -2506,8 +2498,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
}
|
||||
|
||||
// skip any spaces at cursor
|
||||
while (text.charAt(searchOffset) == ' '
|
||||
&& searchOffset < text.length()) {
|
||||
while ((text.charAt(searchOffset) == ' ')
|
||||
&& (searchOffset < text.length())) {
|
||||
searchOffset++;
|
||||
}
|
||||
|
||||
|
@ -2516,7 +2508,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
// set missing to end of text
|
||||
if (index == -1) {
|
||||
index = text.length() - 1;
|
||||
} else if (index < text.length() - 1) {
|
||||
} else if (index < (text.length() - 1)) {
|
||||
// skip the space
|
||||
index++;
|
||||
}
|
||||
|
@ -2677,7 +2669,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
int line = textEditor.getLineAtOffset(caretOffset);
|
||||
int finish;
|
||||
|
||||
if (line + 1 < textEditor.getLineCount()) {
|
||||
if ((line + 1) < textEditor.getLineCount()) {
|
||||
finish = textEditor.getOffsetAtLine(line + 1) - 1;
|
||||
} else {
|
||||
// Guard against over-indexing in getText()
|
||||
|
@ -2833,7 +2825,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
}
|
||||
}
|
||||
|
||||
if (selectionCnt == 0 && autoWrapCfg.getButtons().size() > 0) {
|
||||
if ((selectionCnt == 0) && (autoWrapCfg.getButtons().size() > 0)) {
|
||||
WrapButtonCfg buttonCfg = autoWrapCfg.getButtons().get(0);
|
||||
message.append("No button selected. Selecting top item \"")
|
||||
.append(buttonCfg.getLabelName()).append("\"\n");
|
||||
|
@ -2922,7 +2914,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
private void createTextCharWrapDialog(final int rangeStart,
|
||||
final int rangeEnd) {
|
||||
// Create the text character wrap dialog.
|
||||
if (textCharWrapDlg == null || textCharWrapDlg.isDisposed()) {
|
||||
if ((textCharWrapDlg == null) || textCharWrapDlg.isDisposed()) {
|
||||
textCharWrapDlg = new TextCharWrapDlg(shell, this,
|
||||
otherCharWrapCol, rangeStart, rangeEnd);
|
||||
|
||||
|
@ -2954,8 +2946,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
|
||||
FontSizeCfg fontSizeCfg = TextEditorCfg.getTextEditorCfg()
|
||||
.getFontSizeCfg();
|
||||
SizeButtonCfg seldFontBtn = TextEditorCfg.getTextEditorCfg()
|
||||
.getSelectedFontButton();
|
||||
SizeButtonCfg seldFontBtn = TextEditorCfg.getSelectedFontButton();
|
||||
|
||||
for (SizeButtonCfg buttonCfg : fontSizeCfg.getButtons()) {
|
||||
MenuItem item = new MenuItem(fontSizeSubMenu, SWT.RADIO);
|
||||
|
@ -3399,7 +3390,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
public void widgetDefaultSelected(SelectionEvent event) {
|
||||
awipsIdTF.setText(awipsIdTF.getText().trim().toUpperCase());
|
||||
int charCount = awipsIdTF.getCharCount();
|
||||
if (charCount < 4 || charCount > 6) {
|
||||
if ((charCount < 4) || (charCount > 6)) {
|
||||
userInformation("Must enter a 4 to 6 character AWIPS ID");
|
||||
awipsIdTF.setFocus();
|
||||
return;
|
||||
|
@ -3502,7 +3493,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
*/
|
||||
private void clearUpdateFlag(int offset) {
|
||||
for (StyleRange range : textEditor.getStyleRanges()) {
|
||||
if (range.start <= offset && offset < (range.start + range.length)) {
|
||||
if ((range.start <= offset)
|
||||
&& (offset < (range.start + range.length))) {
|
||||
StyleRange lock = (StyleRange) range.clone();
|
||||
lock.background = null;
|
||||
lock.foreground = null;
|
||||
|
@ -3702,13 +3694,13 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
editorInsertCmb.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
if (editorInsertCmb.getSelectionIndex() == INSERT_TEXT
|
||||
&& overwriteMode == true) {
|
||||
if ((editorInsertCmb.getSelectionIndex() == INSERT_TEXT)
|
||||
&& (overwriteMode == true)) {
|
||||
textEditor.invokeAction(ST.TOGGLE_OVERWRITE);
|
||||
overwriteMode = false;
|
||||
overStrikeItem.setSelection(false);
|
||||
} else if (editorInsertCmb.getSelectionIndex() == OVERWRITE_TEXT
|
||||
&& overwriteMode == false) {
|
||||
} else if ((editorInsertCmb.getSelectionIndex() == OVERWRITE_TEXT)
|
||||
&& (overwriteMode == false)) {
|
||||
textEditor.invokeAction(ST.TOGGLE_OVERWRITE);
|
||||
overwriteMode = true;
|
||||
overStrikeItem.setSelection(true);
|
||||
|
@ -3778,7 +3770,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
textEditor.addKeyListener(new KeyAdapter() {
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if (e.keyCode == SWT.ARROW_LEFT && !textEditor.getEditable()) {
|
||||
if ((e.keyCode == SWT.ARROW_LEFT) && !textEditor.getEditable()) {
|
||||
commandHistory.resetIndex(CommandType.AFOS);
|
||||
ICommand command = commandHistory
|
||||
.getPreviousCommand(CommandType.AFOS);
|
||||
|
@ -3789,7 +3781,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
executeCommand(cmd);
|
||||
}
|
||||
}
|
||||
} else if (e.keyCode == SWT.ARROW_RIGHT
|
||||
} else if ((e.keyCode == SWT.ARROW_RIGHT)
|
||||
&& !textEditor.getEditable()) {
|
||||
commandHistory.resetIndex(CommandType.AFOS);
|
||||
ICommand command = commandHistory
|
||||
|
@ -3841,13 +3833,13 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
if (textEditor.getEditable() == false) {
|
||||
return;
|
||||
}
|
||||
if (event.keyCode == SWT.DEL || event.keyCode == SWT.BS
|
||||
|| event.keyCode == SWT.SHIFT) {
|
||||
if ((event.keyCode == SWT.DEL) || (event.keyCode == SWT.BS)
|
||||
|| (event.keyCode == SWT.SHIFT)) {
|
||||
// Do nothing...
|
||||
// We need to capture the Delete, Backspace and Shift
|
||||
// keystrokes...
|
||||
} else if (event.keyCode == SWT.HOME
|
||||
|| event.keyCode == SWT.END) {
|
||||
} else if ((event.keyCode == SWT.HOME)
|
||||
|| (event.keyCode == SWT.END)) {
|
||||
if (!textEditor.getEditable()) {
|
||||
int offset = 0;
|
||||
|
||||
|
@ -3859,17 +3851,17 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
textEditor.showSelection();
|
||||
event.doit = false;
|
||||
}
|
||||
} else if (event.keyCode == SWT.PAGE_UP
|
||||
&& event.stateMask == SWT.CTRL) {
|
||||
} else if ((event.keyCode == SWT.PAGE_UP)
|
||||
&& (event.stateMask == SWT.CTRL)) {
|
||||
event.doit = false; // Ingnore Ctrl + PageUp
|
||||
} else if (event.keyCode == SWT.PAGE_DOWN
|
||||
&& event.stateMask == SWT.CTRL) {
|
||||
} else if ((event.keyCode == SWT.PAGE_DOWN)
|
||||
&& (event.stateMask == SWT.CTRL)) {
|
||||
event.doit = false; // Ignore Ctrl + PageDown
|
||||
} else if (event.keyCode == SWT.PAGE_UP
|
||||
&& event.stateMask == (SWT.CTRL | SWT.SHIFT)) {
|
||||
} else if ((event.keyCode == SWT.PAGE_UP)
|
||||
&& (event.stateMask == (SWT.CTRL | SWT.SHIFT))) {
|
||||
event.doit = false; // Ignore Ctrl+Shift+PageUp
|
||||
} else if (event.keyCode == SWT.PAGE_DOWN
|
||||
&& event.stateMask == (SWT.CTRL | SWT.SHIFT)) {
|
||||
} else if ((event.keyCode == SWT.PAGE_DOWN)
|
||||
&& (event.stateMask == (SWT.CTRL | SWT.SHIFT))) {
|
||||
event.doit = false; // Ignore Ctrl+Shift+PageDown
|
||||
} else if (event.keyCode == SWT.INSERT) {
|
||||
// Ins key on the keypad
|
||||
|
@ -3891,20 +3883,13 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
|
||||
// if some event is going to happen and the key was not enter
|
||||
// then set userKeyPressed to true
|
||||
if (event.doit && event.character != 0
|
||||
&& event.character != '\r' && event.character != '\n') {
|
||||
if (event.doit && (event.character != 0)
|
||||
&& (event.character != '\r')
|
||||
&& (event.character != '\n')) {
|
||||
userKeyPressed = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
textEditor.addModifyListener(new ModifyListener() {
|
||||
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
// when we modify the text, we want to set the 'dirty' flag.
|
||||
dirty = true;
|
||||
}
|
||||
});
|
||||
|
||||
textEditor.addMouseListener(new MouseListener() {
|
||||
@Override
|
||||
|
@ -3952,38 +3937,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
});
|
||||
}
|
||||
|
||||
// private TextColorsCfg getTextColorCfg() {
|
||||
// TextColorsCfg textColorsCfg =
|
||||
// TextEditorCfg.getTextEditorCfg().getTextColorsCfg();
|
||||
//
|
||||
// // Perform Sanity Checks on configuration.
|
||||
// StringBuilder message = new StringBuilder();
|
||||
//
|
||||
// for (TextColorElement textElm : textColorsCfg.getTextColorElements()) {
|
||||
// String prmtName = textElm.getParamName();
|
||||
// if (prmtName == null) {
|
||||
// message.append("Item \"paramName\" problem!\n");
|
||||
//
|
||||
// }
|
||||
//
|
||||
// if( textElm.getColor() == null ) {
|
||||
// message.append("Item \"color\" data enter problem!\n");
|
||||
// }
|
||||
//
|
||||
// if (message.length() > 0) {
|
||||
// message.insert(0, "TextColorsCfg broblem(s): ");
|
||||
// IUFStatusHandler statusHandler = UFStatus
|
||||
// .getHandler(TextEditorDialog.class);
|
||||
// statusHandler.handle(Priority.PROBLEM, message.toString());
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// return textColorsCfg;
|
||||
// }
|
||||
|
||||
private void setDefaultTextColor(TextEditorCfg txtClrCfg) {
|
||||
|
||||
textBackground = new Color(shell.getDisplay(),
|
||||
txtClrCfg.getTextBackgroundColor());
|
||||
textForeground = new Color(shell.getDisplay(),
|
||||
|
@ -4120,7 +4074,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
private void enterEditor() {
|
||||
StdTextProduct product = TextDisplayModel.getInstance()
|
||||
.getStdTextProduct(token);
|
||||
if (product != null
|
||||
if ((product != null)
|
||||
&& gfeForbidden(product.getCccid(), product.getNnnid())) {
|
||||
// Pop up forbidden window.
|
||||
inEditMode = false;
|
||||
|
@ -4130,7 +4084,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
// Set the edit mode flag to true.
|
||||
inEditMode = true;
|
||||
int ranges[] = textEditor.getRanges();
|
||||
if (ranges == null || ranges.length == 0) {
|
||||
if ((ranges == null) || (ranges.length == 0)) {
|
||||
originalText = removeSoftReturns(textEditor.getText());
|
||||
} else {
|
||||
textEditor.setText(originalText);
|
||||
|
@ -4221,7 +4175,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
|
||||
stopAutoSave();
|
||||
|
||||
if (warnGenFlag && queuedProduct != null) {
|
||||
if (warnGenFlag && (queuedProduct != null)) {
|
||||
// Display the WarnGen in the queue, perform the popup and stop the
|
||||
// cancel.
|
||||
showWarngenProduct(queuedProduct, queuedNotify);
|
||||
|
@ -4275,9 +4229,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
originalText = combineOriginalMessage();
|
||||
}
|
||||
|
||||
// update editor status flags
|
||||
dirty = false;
|
||||
|
||||
if (originalText != null) {
|
||||
textEditor.setText(originalText);
|
||||
}
|
||||
|
@ -4317,8 +4268,9 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
* false otherwise.
|
||||
*/
|
||||
private void editHeader(String warning, boolean closeEditorOnCancel) {
|
||||
if (headerEditSession != null)
|
||||
if (headerEditSession != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Create and display the AWIPS header block dialog.
|
||||
AWIPSHeaderBlockDlg awipsHeaderBlockDlg = new AWIPSHeaderBlockDlg(
|
||||
|
@ -4377,16 +4329,18 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
|
||||
editing = true;
|
||||
} else {
|
||||
if (lastSession == HeaderEditSession.CLOSE_ON_EXIT)
|
||||
if (lastSession == HeaderEditSession.CLOSE_ON_EXIT) {
|
||||
editing = !cancelEditor(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (lastSession == HeaderEditSession.CLOSE_ON_EXIT)
|
||||
if (lastSession == HeaderEditSession.CLOSE_ON_EXIT) {
|
||||
if (editing) {
|
||||
StdTextProduct product = TextDisplayModel.getInstance()
|
||||
.getStdTextProduct(token);
|
||||
if (product == null)
|
||||
if (product == null) {
|
||||
return;
|
||||
}
|
||||
if (autoSave == null) {
|
||||
// user can cancel the edit immediately when the header is
|
||||
// displayed, verify it was not cancelled before starting
|
||||
|
@ -4398,6 +4352,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
} else {
|
||||
stopAutoSave();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4436,8 +4391,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
// Disabled when in editor mode
|
||||
// ---------------------------------
|
||||
resendWarningProductnItem.setEnabled(!inEditMode
|
||||
&& textEditor.getText() != null
|
||||
&& textEditor.getText().length() > 0);
|
||||
&& (textEditor.getText() != null)
|
||||
&& (textEditor.getText().length() > 0));
|
||||
|
||||
// ---------------------------------
|
||||
// File Menu menu items
|
||||
|
@ -4658,7 +4613,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
dlg.setText("Attach File");
|
||||
dlg.setFilterNames(FILTER_NAMES);
|
||||
dlg.setFilterExtensions(FILTER_EXTS);
|
||||
if (attachedFilename != null && attachedFilename.trim().length() > 0) {
|
||||
if ((attachedFilename != null)
|
||||
&& (attachedFilename.trim().length() > 0)) {
|
||||
int startIndex = statusBarLabel.getText().indexOf(":") + 1;
|
||||
int endIndex = statusBarLabel.getText().lastIndexOf(File.separator) + 1;
|
||||
String filterPath = statusBarLabel.getText().substring(startIndex,
|
||||
|
@ -4676,9 +4632,9 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
byte[] bytes = new byte[(int) file.length()];
|
||||
int offset = 0;
|
||||
int numRead = 0;
|
||||
while (offset < bytes.length
|
||||
&& (numRead = in.read(bytes, offset, bytes.length
|
||||
- offset)) >= 0) {
|
||||
while ((offset < bytes.length)
|
||||
&& ((numRead = in.read(bytes, offset, bytes.length
|
||||
- offset)) >= 0)) {
|
||||
offset += numRead;
|
||||
}
|
||||
in.close();
|
||||
|
@ -4734,7 +4690,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
s.append(removeSoftReturns(textEditor.getText()));
|
||||
int eolIndex = s.indexOf("\n");
|
||||
int ddhhmmIndex = s.indexOf("DDHHMM");
|
||||
if (ddhhmmIndex > 0 && ddhhmmIndex < eolIndex) {
|
||||
if ((ddhhmmIndex > 0) && (ddhhmmIndex < eolIndex)) {
|
||||
s.replace(ddhhmmIndex, ddhhmmIndex + 6, "000000");
|
||||
}
|
||||
out.append(s);
|
||||
|
@ -5011,10 +4967,16 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
oup.setSource("TextWS");
|
||||
oup.setWmoType(fixNOR(prod.getBbbid()));
|
||||
oup.setUserDateTimeStamp(prod.getHdrtime());
|
||||
oup.setFilename(awipsID + ".wan"
|
||||
+ (System.currentTimeMillis() / 1000));
|
||||
StringBuilder fileName = new StringBuilder();
|
||||
|
||||
// The .wan extension followed by the 10 digit epoch seconds
|
||||
// of simulated time is used in EDEX's WarningDecoder to
|
||||
// determine the base time.
|
||||
fileName.append(awipsID).append(".wan")
|
||||
.append(TimeUtil.getUnixTime(TimeUtil.newDate()));
|
||||
oup.setFilename(fileName.toString());
|
||||
oup.setAddress(addressee);
|
||||
if (attachedFile != null && attachedFilename != null) {
|
||||
if ((attachedFile != null) && (attachedFilename != null)) {
|
||||
oup.setAttachedFile(attachedFile);
|
||||
oup.setAttachedFilename(attachedFilename);
|
||||
}
|
||||
|
@ -5050,7 +5012,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
}
|
||||
}
|
||||
|
||||
if (inEditMode == false && resend == false) {
|
||||
if ((inEditMode == false) && (resend == false)) {
|
||||
saved = true;
|
||||
StdTextProductId finalProduct = this.getStdTextProduct()
|
||||
.getProdId();
|
||||
|
@ -5110,7 +5072,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
synchronized private void saveProduct() {
|
||||
StdTextProduct product = TextDisplayModel.getInstance()
|
||||
.getStdTextProduct(token);
|
||||
if (product != null
|
||||
if ((product != null)
|
||||
&& gfeForbidden(product.getCccid(), product.getNnnid())) {
|
||||
// Pop up forbidden window.
|
||||
inEditMode = false;
|
||||
|
@ -5120,7 +5082,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
boolean successful = saveEditedProduct(false, false, false);
|
||||
if (successful) {
|
||||
// reset the editor status flags
|
||||
dirty = false;
|
||||
saved = true;
|
||||
replaceWorkProductId();
|
||||
originalText = combineOriginalMessage();
|
||||
|
@ -5144,7 +5105,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
boolean resend, boolean isOperationalSend) {
|
||||
StdTextProduct product = TextDisplayModel.getInstance()
|
||||
.getStdTextProduct(token);
|
||||
if (product != null
|
||||
if ((product != null)
|
||||
&& gfeForbidden(product.getCccid(), product.getNnnid())) {
|
||||
// Pop up forbidden window.
|
||||
inEditMode = false;
|
||||
|
@ -5157,7 +5118,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
* DR14613 - string currectDate is derived from Date now ensuring the
|
||||
* same time in WMO heading and in the MND heading.
|
||||
*/
|
||||
Date now = SimulatedTime.getSystemTime().getTime();
|
||||
Date now = TimeUtil.newDate();
|
||||
String currentDate = getCurrentDate(now);
|
||||
TextDisplayModel tdmInst = TextDisplayModel.getInstance();
|
||||
|
||||
|
@ -5186,7 +5147,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
String productText = resend ? resendMessage()
|
||||
: combineOriginalMessage();
|
||||
|
||||
if (warnGenFlag == true && resend == false) {
|
||||
if ((warnGenFlag == true) && (resend == false)) {
|
||||
productText = removeSoftReturns(productText);
|
||||
}
|
||||
|
||||
|
@ -5291,16 +5252,18 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
String[] parts = productText.split("\n", 2);
|
||||
if (parts.length > 0) {
|
||||
String[] headerParts = parts[0].split("\\s+", 0);
|
||||
if (headerParts.length >= 3)
|
||||
if (headerParts.length >= 3) {
|
||||
headerParts[2] = ddhhmm;
|
||||
}
|
||||
// TODO: else raise error?
|
||||
StringBuilder sb = new StringBuilder(productText.length());
|
||||
boolean first = true;
|
||||
for (String s : headerParts) {
|
||||
if (first)
|
||||
if (first) {
|
||||
first = false;
|
||||
else
|
||||
} else {
|
||||
sb.append(' ');
|
||||
}
|
||||
sb.append(s);
|
||||
}
|
||||
if (parts.length > 1) {
|
||||
|
@ -5342,8 +5305,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
textEditor.addVerifyListener(TextEditorDialog.this);
|
||||
|
||||
for (StyleRange lock : locks) {
|
||||
if (0 <= lock.start
|
||||
&& lock.start + lock.length <= textEditor.getCharCount()) {
|
||||
if ((0 <= lock.start)
|
||||
&& ((lock.start + lock.length) <= textEditor.getCharCount())) {
|
||||
textEditor.setStyleRange(lock);
|
||||
}
|
||||
}
|
||||
|
@ -5408,7 +5371,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
private boolean saveStoredTextProduct(StdTextProduct storedProduct) {
|
||||
StdTextProduct product = TextDisplayModel.getInstance()
|
||||
.getStdTextProduct(token);
|
||||
if (product != null
|
||||
if ((product != null)
|
||||
&& gfeForbidden(product.getCccid(), product.getNnnid())) {
|
||||
// Pop up forbidden window.
|
||||
inEditMode = false;
|
||||
|
@ -5478,13 +5441,13 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
do {
|
||||
startIndex = sb.indexOf(BEGIN_ELEMENT_TAG, currentIndex);
|
||||
endIndex = sb.indexOf(END_ELEMENT_TAG, currentIndex);
|
||||
} while (startIndex > 0
|
||||
&& endIndex > 0
|
||||
&& (currentIndex = sb.indexOf(BEGIN_ELEMENT_TAG,
|
||||
startIndex + BEGIN_ELEMENT_TAG_LEN)) > 0
|
||||
&& currentIndex < endIndex);
|
||||
} while ((startIndex > 0)
|
||||
&& (endIndex > 0)
|
||||
&& ((currentIndex = sb.indexOf(BEGIN_ELEMENT_TAG,
|
||||
startIndex + BEGIN_ELEMENT_TAG_LEN)) > 0)
|
||||
&& (currentIndex < endIndex));
|
||||
|
||||
if (currentIndex > 0 && currentIndex < endIndex) {
|
||||
if ((currentIndex > 0) && (currentIndex < endIndex)) {
|
||||
startIndex = currentIndex;
|
||||
}
|
||||
|
||||
|
@ -5537,14 +5500,15 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
int length = event.end - event.start;
|
||||
try {
|
||||
if (length == 0) {
|
||||
if (event.start != 0
|
||||
&& event.start != textEditor.getCharCount()) {
|
||||
if ((event.start != 0)
|
||||
&& (event.start != textEditor.getCharCount())) {
|
||||
int ranges[] = textEditor.getRanges(event.start - 1,
|
||||
length + 2);
|
||||
for (int i = 0; i < ranges.length; i += 2) {
|
||||
int rangeStart = ranges[i];
|
||||
int rangeEnd = rangeStart + ranges[i + 1];
|
||||
if (event.start > rangeStart && event.start < rangeEnd) {
|
||||
if ((event.start > rangeStart)
|
||||
&& (event.start < rangeEnd)) {
|
||||
event.doit = false;
|
||||
/*
|
||||
* DR15704 - this needs to be set so the rewrap is
|
||||
|
@ -5557,7 +5521,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
}
|
||||
} else {
|
||||
int ranges[] = textEditor.getRanges(event.start, length);
|
||||
if (inEditMode && ranges != null && ranges.length != 0) {
|
||||
if (inEditMode && (ranges != null) && (ranges.length != 0)) {
|
||||
event.doit = false;
|
||||
/*
|
||||
* DR15704 - this needs to be set so the rewrap is not
|
||||
|
@ -5698,7 +5662,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
numberOfBlankLines++;
|
||||
line = textEditor.getLine(thisLine
|
||||
+ numberOfLinesOfHeaderText + numberOfBlankLines);
|
||||
} while (line.length() == 0 || line.equals(""));
|
||||
} while ((line.length() == 0) || line.equals(""));
|
||||
// Note: 'st' is a reference to 'textEditor'...
|
||||
// delelete the header from the text in 'textEditor'
|
||||
finish = textEditor.getOffsetAtLine(thisLine
|
||||
|
@ -5712,8 +5676,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
textEditor.setText("");
|
||||
}
|
||||
}
|
||||
// set editor status flags
|
||||
dirty = false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5763,7 +5725,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
*/
|
||||
private String updateVtecTimes(String product, VtecObject vtecObj, Date now) {
|
||||
|
||||
if (vtecObj == null || vtecObj.getAction().equals("COR")) {
|
||||
if ((vtecObj == null) || vtecObj.getAction().equals("COR")) {
|
||||
return product;
|
||||
}
|
||||
// Update the vtec start time
|
||||
|
@ -5945,7 +5907,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
boolean validExecuteCommand = command != null;
|
||||
|
||||
if (validExecuteCommand) {
|
||||
if (prodList != null && prodList.size() > 0) {
|
||||
if ((prodList != null) && (prodList.size() > 0)) {
|
||||
if (prodList.size() > 1) {
|
||||
if (CommandType.WMO.equals(command.getType())) {
|
||||
final boolean hasAtt = hasAttachment;
|
||||
|
@ -6433,7 +6395,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
public void manageScriptOutputWindow(boolean visible) {
|
||||
if (visible) {
|
||||
// need to set state of menu item to true
|
||||
if (scriptsShowOutputItem != null
|
||||
if ((scriptsShowOutputItem != null)
|
||||
&& !scriptsShowOutputItem.isDisposed()) {
|
||||
scriptsShowOutputItem.setSelection(true);
|
||||
}
|
||||
|
@ -6444,7 +6406,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
}
|
||||
|
||||
// create the script output window
|
||||
if (scriptOutput == null || !scriptOutput.isDisposed()) {
|
||||
if ((scriptOutput == null) || !scriptOutput.isDisposed()) {
|
||||
scriptOutput = new ScriptOutputDlg(shell, token);
|
||||
// open the script output window
|
||||
scriptOutput.setCloseCallback(new ICloseCallback() {
|
||||
|
@ -6452,7 +6414,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
// update the menu following close
|
||||
if (scriptsShowOutputItem != null
|
||||
if ((scriptsShowOutputItem != null)
|
||||
&& !scriptsShowOutputItem.isDisposed()) {
|
||||
scriptsShowOutputItem.setSelection(false);
|
||||
}
|
||||
|
@ -6471,7 +6433,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
if (scriptOutput != null) {
|
||||
scriptOutput.close();
|
||||
} else {
|
||||
if (scriptsShowOutputItem != null
|
||||
if ((scriptsShowOutputItem != null)
|
||||
&& !scriptsShowOutputItem.isDisposed()) {
|
||||
scriptsShowOutputItem.setSelection(false);
|
||||
}
|
||||
|
@ -7062,7 +7024,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
String body = textEditor.getText();
|
||||
StdTextProduct stdTextProduct = TextDisplayModel.getInstance()
|
||||
.getStdTextProduct(token);
|
||||
if (body == null || body.length() == 0) {
|
||||
if ((body == null) || (body.length() == 0)) {
|
||||
userInformation("Resend Warning Product Error",
|
||||
"There is no product to send. \n Action aborted!");
|
||||
resend = false;
|
||||
|
@ -7113,7 +7075,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
String text = textEditor.getText();
|
||||
int startIndex = text.indexOf("!--");
|
||||
int endIndex = text.indexOf("--!", startIndex);
|
||||
while (startIndex >= 0 && endIndex >= startIndex) {
|
||||
while ((startIndex >= 0) && (endIndex >= startIndex)) {
|
||||
String part1 = text.substring(0, startIndex).trim();
|
||||
String part2 = text.substring(endIndex + 3).trim();
|
||||
text = part1 + "\n\n" + part2;
|
||||
|
@ -7176,7 +7138,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
// delete and write new file, rename didn't always work
|
||||
// rename would end up writing a new file every time and
|
||||
// kept the original in sync
|
||||
if (file != null && file.exists()) {
|
||||
if ((file != null) && file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
|
||||
|
@ -7221,8 +7183,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
xml = new String(b);
|
||||
}
|
||||
|
||||
rval = (StdTextProduct) SerializationUtil
|
||||
.unmarshalFromXml(xml);
|
||||
rval = SerializationUtil.unmarshalFromXml(
|
||||
StdTextProduct.class, xml);
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Retrieval of product failed", e);
|
||||
|
@ -7264,13 +7226,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
return success;
|
||||
}
|
||||
|
||||
public void stopTimer() {
|
||||
if (timer != null) {
|
||||
timer.cancel();
|
||||
timer = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void setupTimer() {
|
||||
if (timer != null) {
|
||||
timer.cancel();
|
||||
|
@ -7508,7 +7463,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
int x = rect.width / 4;
|
||||
|
||||
// account for dual monitor
|
||||
if (rect.width > rect.height * 2) {
|
||||
if (rect.width > (rect.height * 2)) {
|
||||
x /= 2;
|
||||
}
|
||||
|
||||
|
@ -7517,7 +7472,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
.intValue();
|
||||
|
||||
int offset = (editorIndex - 1) * 25;
|
||||
getShell().setLocation(x + offset, rect.height / 4 + offset);
|
||||
getShell().setLocation(x + offset, (rect.height / 4) + offset);
|
||||
}
|
||||
|
||||
inEditMode = false;
|
||||
|
@ -7656,8 +7611,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
if (hasLockAtOffset(offset)) {
|
||||
StyleRange[] ranges = textEditor.getStyleRanges();
|
||||
for (StyleRange range : ranges) {
|
||||
if (offset >= range.start
|
||||
&& offset <= range.start + range.length) {
|
||||
if ((offset >= range.start)
|
||||
&& (offset <= (range.start + range.length))) {
|
||||
rval = range.start;
|
||||
break;
|
||||
}
|
||||
|
@ -7677,8 +7632,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
if (hasLockAtOffset(offset)) {
|
||||
StyleRange[] ranges = textEditor.getStyleRanges();
|
||||
for (StyleRange range : ranges) {
|
||||
if (offset >= range.start
|
||||
&& offset <= range.start + range.length) {
|
||||
if ((offset >= range.start)
|
||||
&& (offset <= (range.start + range.length))) {
|
||||
rval = range.length;
|
||||
break;
|
||||
}
|
||||
|
@ -7700,7 +7655,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
int lineLength = textEditor.getLine(lineNumber).length();
|
||||
|
||||
StyleRange[] ranges = textEditor.getStyleRanges(lineStart, lineLength);
|
||||
if (ranges != null && ranges.length > 0) {
|
||||
if ((ranges != null) && (ranges.length > 0)) {
|
||||
rval = true;
|
||||
}
|
||||
return rval;
|
||||
|
@ -7783,7 +7738,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
padding = " ";
|
||||
}
|
||||
|
||||
if (inLocations && paragraphStartLineNumber == lineNumber) {
|
||||
if (inLocations && (paragraphStartLineNumber == lineNumber)) {
|
||||
// Keep LOCATIONS first line short & don't paste more to it.
|
||||
if (line.indexOf("...") == line.lastIndexOf("...")) {
|
||||
return;
|
||||
|
@ -7815,7 +7770,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
if (lineNumber < endWrapLine) {
|
||||
// May have more lines to wrap.
|
||||
int nextLine = lineNumber + 1;
|
||||
while (nextLine <= endWrapLine
|
||||
while ((nextLine <= endWrapLine)
|
||||
&& textEditor.getLine(nextLine).trim().isEmpty()) {
|
||||
++nextLine;
|
||||
}
|
||||
|
@ -7848,7 +7803,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
|
||||
// If the next line is part of the same paragraph and not empty make it
|
||||
// part of the current line.
|
||||
if (lineNumber + 1 < textEditor.getLineCount()) {
|
||||
if ((lineNumber + 1) < textEditor.getLineCount()) {
|
||||
// if the next line does not start a new paragraph
|
||||
if (!isParagraphStart(lineNumber + 1)) {
|
||||
// if the next line is not empty
|
||||
|
@ -7860,8 +7815,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
String allText = textEditor.getText();
|
||||
int eol = textEditor.getOffsetAtLine(lineNumber)
|
||||
+ line.length();
|
||||
if (allText.charAt(eol) == '\r'
|
||||
&& allText.charAt(eol + 1) == '\n') {
|
||||
if ((allText.charAt(eol) == '\r')
|
||||
&& (allText.charAt(eol + 1) == '\n')) {
|
||||
deleteLen = 2;
|
||||
} else if (allText.charAt(eol) == '\n') {
|
||||
deleteLen = 1;
|
||||
|
@ -7876,7 +7831,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
// if the line does not start with a lock
|
||||
int lineStart = textEditor
|
||||
.getOffsetAtLine(lineNumber + 1);
|
||||
if (padding.length() > 0
|
||||
if ((padding.length() > 0)
|
||||
&& textEditor.getLine(lineNumber + 1)
|
||||
.startsWith(padding)) {
|
||||
// add two to skip over padding if it exists and
|
||||
|
@ -7889,7 +7844,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
// if the lock is too long to fit on this line do
|
||||
// not bring up the next line
|
||||
int lockLength = getLengthOfLockAtOffset(lockStart);
|
||||
if (line.length() + lockLength > charWrapCol) {
|
||||
if ((line.length() + lockLength) > charWrapCol) {
|
||||
// lock is too long, do not bring up next
|
||||
// line
|
||||
return;
|
||||
|
@ -7900,7 +7855,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
int lineStartOffset = textEditor
|
||||
.getOffsetAtLine(lineNumber);
|
||||
int newlinePosition = lineStartOffset + line.length();
|
||||
if (padding.length() > 0
|
||||
if ((padding.length() > 0)
|
||||
&& textEditor.getLine(lineNumber + 1).startsWith(
|
||||
" ")) {
|
||||
deleteLen += padding.length();
|
||||
|
@ -7999,7 +7954,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
int padLen = padding.length();
|
||||
if (padLen > 0) {
|
||||
int cnt = 0;
|
||||
while (cnt < padLen
|
||||
while ((cnt < padLen)
|
||||
&& textEditor.getText(position + cnt, position + cnt)
|
||||
.equals(" ")) {
|
||||
++cnt;
|
||||
|
@ -8021,7 +7976,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
*/
|
||||
private void checkAndWrapNextLine(int line) {
|
||||
// if there is a next line
|
||||
if (line + 1 < textEditor.getLineCount()) {
|
||||
if ((line + 1) < textEditor.getLineCount()) {
|
||||
// if the next line does not start a new paragraph
|
||||
if (!isParagraphStart(line + 1)) {
|
||||
// if the next line is not empty ( marks the end of a paragraph
|
||||
|
@ -8029,10 +7984,10 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
if (!textEditor.getLine(line + 1).trim().isEmpty()) {
|
||||
// rewrap the next line
|
||||
rewrapInternal(line + 1);
|
||||
} else if (line + 1 < endWrapLine) {
|
||||
} else if ((line + 1) < endWrapLine) {
|
||||
// See if another paragraph needs to be wrapped.
|
||||
int nextLine = line + 1;
|
||||
while (nextLine <= endWrapLine
|
||||
while ((nextLine <= endWrapLine)
|
||||
&& textEditor.getLine(nextLine).trim().isEmpty()) {
|
||||
++nextLine;
|
||||
}
|
||||
|
@ -8040,7 +7995,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
rewrapInternal(nextLine);
|
||||
}
|
||||
}
|
||||
} else if (line + 1 <= endWrapLine) {
|
||||
} else if ((line + 1) <= endWrapLine) {
|
||||
rewrapInternal(line + 1);
|
||||
}
|
||||
}
|
||||
|
@ -8083,7 +8038,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
if (isPreviousLineWrapped) {
|
||||
return;
|
||||
}
|
||||
if (line - 1 > 0) {
|
||||
if ((line - 1) > 0) {
|
||||
// if the previous line does not start a new paragraph
|
||||
if (!isParagraphStart(line - 1)) {
|
||||
// if the previous line is not empty ( marks the end of a
|
||||
|
@ -8093,10 +8048,10 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
// rewrap the previous line
|
||||
isPreviousLineWrapped = true;
|
||||
rewrapInternal(line - 1);
|
||||
} else if (line - 1 < endWrapLine) {
|
||||
} else if ((line - 1) < endWrapLine) {
|
||||
// See if another paragraph needs to be wrapped.
|
||||
int nextLine = line - 1;
|
||||
while (nextLine <= endWrapLine
|
||||
while ((nextLine <= endWrapLine)
|
||||
&& textEditor.getLine(nextLine).trim().isEmpty()) {
|
||||
--nextLine;
|
||||
}
|
||||
|
@ -8105,7 +8060,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
rewrapInternal(nextLine);
|
||||
}
|
||||
}
|
||||
} else if (line - 1 <= endWrapLine) {
|
||||
} else if ((line - 1) <= endWrapLine) {
|
||||
isPreviousLineWrapped = true;
|
||||
rewrapInternal(line - 1);
|
||||
}
|
||||
|
@ -8122,7 +8077,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
*/
|
||||
private boolean checkParagraphPadding(String firstLine) {
|
||||
boolean rval = false;
|
||||
if (firstLine.length() > 0
|
||||
if ((firstLine.length() > 0)
|
||||
&& PADDED_PARAGRAPH_DELIMITERS.contains(firstLine.substring(0,
|
||||
1))) {
|
||||
rval = true;
|
||||
|
@ -8168,7 +8123,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
rval = true;
|
||||
} else if (PARAGRAPH_DELIMITERS.contains(lineText.substring(0, 1))) {
|
||||
rval = true;
|
||||
} else if (isSaoMetarFlag && lineText.startsWith(" ") == false) {
|
||||
} else if (isSaoMetarFlag && (lineText.startsWith(" ") == false)) {
|
||||
rval = true;
|
||||
}
|
||||
return rval;
|
||||
|
@ -8276,8 +8231,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
|
||||
if (lineOffset > 0) {
|
||||
boolean goBack = true;
|
||||
while (goBack && lineIndex > 0) {
|
||||
if (lineText.startsWith(" ") || lineText.length() == 0) {
|
||||
while (goBack && (lineIndex > 0)) {
|
||||
if (lineText.startsWith(" ") || (lineText.length() == 0)) {
|
||||
lineIndex--;
|
||||
} else {
|
||||
String tempLine = st.getLine(lineIndex);
|
||||
|
@ -8306,10 +8261,9 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
boolean result = false;
|
||||
|
||||
byte[] bytesFromFile = getBytesFromFile(file);
|
||||
for (int i = 0; i < bytesFromFile.length; i++) {
|
||||
byte b = bytesFromFile[i];
|
||||
if (b == 0x09 || b == 0x0A || b == 0x0C || b == 0x0D
|
||||
|| (b >= 0x20 && b <= 0x7E)) {
|
||||
for (byte b : bytesFromFile) {
|
||||
if ((b == 0x09) || (b == 0x0A) || (b == 0x0C) || (b == 0x0D)
|
||||
|| ((b >= 0x20) && (b <= 0x7E))) {
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
|
@ -8322,38 +8276,47 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
* Get the contents of file as a byte array.
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
* @return bytes
|
||||
* @throws IOException
|
||||
*/
|
||||
private static byte[] getBytesFromFile(File file) throws IOException {
|
||||
InputStream is = new FileInputStream(file);
|
||||
InputStream is = null;
|
||||
byte[] bytes = null;
|
||||
|
||||
// Get the size of the file
|
||||
long length = file.length();
|
||||
try {
|
||||
is = new FileInputStream(file);
|
||||
|
||||
if (length > Integer.MAX_VALUE) {
|
||||
// File is too large
|
||||
// Get the size of the file
|
||||
long length = file.length();
|
||||
|
||||
if (length > Integer.MAX_VALUE) {
|
||||
// File is too large
|
||||
}
|
||||
|
||||
// Create the byte array to hold the data
|
||||
bytes = new byte[(int) length];
|
||||
|
||||
// Read in the bytes
|
||||
int offset = 0;
|
||||
int numRead = 0;
|
||||
while ((offset < bytes.length)
|
||||
&& ((numRead = is
|
||||
.read(bytes, offset, bytes.length - offset)) >= 0)) {
|
||||
offset += numRead;
|
||||
}
|
||||
|
||||
// Ensure all the bytes have been read in
|
||||
if (offset < bytes.length) {
|
||||
throw new IOException("Could not completely read file "
|
||||
+ file.getName());
|
||||
}
|
||||
} finally {
|
||||
|
||||
// Close the input stream and return bytes
|
||||
if (is != null) {
|
||||
is.close();
|
||||
}
|
||||
}
|
||||
|
||||
// Create the byte array to hold the data
|
||||
byte[] bytes = new byte[(int) length];
|
||||
|
||||
// Read in the bytes
|
||||
int offset = 0;
|
||||
int numRead = 0;
|
||||
while (offset < bytes.length
|
||||
&& (numRead = is.read(bytes, offset, bytes.length - offset)) >= 0) {
|
||||
offset += numRead;
|
||||
}
|
||||
|
||||
// Ensure all the bytes have been read in
|
||||
if (offset < bytes.length) {
|
||||
throw new IOException("Could not completely read file "
|
||||
+ file.getName());
|
||||
}
|
||||
|
||||
// Close the input stream and return bytes
|
||||
is.close();
|
||||
return bytes;
|
||||
}
|
||||
|
||||
|
@ -8395,7 +8358,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
*/
|
||||
private boolean gfeForbidden(String ccc, String nnn) {
|
||||
boolean retval = false;
|
||||
if (ccc != null && nnn != null) {
|
||||
if ((ccc != null) && (nnn != null)) {
|
||||
if (gfePils.contains(nnn) && !exceptionCCCs.contains(ccc)) {
|
||||
retval = true;
|
||||
}
|
||||
|
@ -8436,9 +8399,10 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
* @return
|
||||
*/
|
||||
private static String fixNOR(String bbb) {
|
||||
if ("NOR".equals(bbb))
|
||||
if ("NOR".equals(bbb)) {
|
||||
return "";
|
||||
else
|
||||
} else {
|
||||
return bbb;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public class FollowupData extends AbstractWarningRecord {
|
|||
/**
|
||||
* String displayed in the drop down update list.
|
||||
*/
|
||||
private String displayString;
|
||||
private final String displayString;
|
||||
|
||||
/**
|
||||
* String used to test if this object is equivalent to one of the updated
|
||||
|
@ -64,7 +64,7 @@ public class FollowupData extends AbstractWarningRecord {
|
|||
/**
|
||||
* Information string used when the follow up is no longer valid or allowed.
|
||||
*/
|
||||
private String expirationString;
|
||||
private final String expirationString;
|
||||
|
||||
public FollowupData(WarningAction action, AbstractWarningRecord record) {
|
||||
super(record);
|
||||
|
@ -194,4 +194,13 @@ public class FollowupData extends AbstractWarningRecord {
|
|||
return expirationString;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.common.dataplugin.PluginDataObject#getPluginName()
|
||||
*/
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "followUpWarning";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -190,6 +190,7 @@ import com.vividsolutions.jts.io.WKTReader;
|
|||
* 08/19/2013 2177 jsanchez Set a GeneralGridGeometry object in the GeospatialDataList.
|
||||
* 09/17/2013 DR 16496 D. Friedman Make editable state more consistent.
|
||||
* 10/01/2013 DR 16632 Qinglu Lin Catch exceptions thrown while doing areaPercent computation and union().
|
||||
* 10/15/2013 2463 jsanchez Create a square polygon when time matched with a resource with no data.
|
||||
* 10/21/2013 DR 16632 D. Friedman Modify areaPercent exception handling. Fix an NPE.
|
||||
* Use A1 hatching behavior when no county passes the inclusion filter.
|
||||
* 10/29/2013 DR 16734 D. Friedman If redraw-from-hatched-area fails, don't allow the pollygon the be used.
|
||||
|
@ -839,12 +840,8 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
|||
int frameCount = trackUtil.getFrameCount(paintProps.getFramesInfo());
|
||||
|
||||
// TODO: Issues with frameCount == 1? Could happen if we update on all
|
||||
// tilts where we had multiple frames then they went away
|
||||
if ((displayState.mode == Mode.TRACK && lastMode == Mode.DRAG_ME)
|
||||
|| (frameCount == 1 && displayState.geomChanged)) {
|
||||
if (frameCount == 1 && displayState.geomChanged) {
|
||||
displayState.geomChanged = false;
|
||||
}
|
||||
// tilts where we had multiple frames then they went away.
|
||||
if (displayState.mode == Mode.TRACK && lastMode == Mode.DRAG_ME) {
|
||||
if (warningAction == null || warningAction == WarningAction.NEW) {
|
||||
// Initialize box
|
||||
redrawBoxFromTrack();
|
||||
|
@ -2046,6 +2043,9 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
|||
&& this.displayState.displayType != DisplayType.POLY) {
|
||||
createSquare();
|
||||
return;
|
||||
} else if (descriptor.getFramesInfo().getFrameCount() == 1) {
|
||||
createSquare();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ import com.raytheon.uf.common.site.SiteMap;
|
|||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.time.ISimulatedTimeChangeListener;
|
||||
import com.raytheon.uf.common.time.SimulatedTime;
|
||||
import com.raytheon.uf.common.time.TimeRange;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
|
@ -76,6 +77,7 @@ import com.vividsolutions.jts.geom.Geometry;
|
|||
* Jul 22, 2013 2176 jsanchez Set the raw message for an EXT.
|
||||
* Aug 14, 2013 DR 16483 Qinglu Lin Fixed no option issue in WarnGen dropdown menu after
|
||||
* issuance of an CANCON and restart of CAVE.
|
||||
* Oct 16, 2013 2439 rferrel Restrict retrieval of warnings to prevent getting future warnings.
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
|
@ -130,9 +132,9 @@ public class CurrentWarnings {
|
|||
|
||||
}
|
||||
|
||||
private static Map<String, CurrentWarnings> instanceMap = new HashMap<String, CurrentWarnings>();
|
||||
private static final Map<String, CurrentWarnings> instanceMap = new HashMap<String, CurrentWarnings>();
|
||||
|
||||
private static Set<IWarningsArrivedListener> listeners = Collections
|
||||
private static final Set<IWarningsArrivedListener> listeners = Collections
|
||||
.synchronizedSet(new HashSet<IWarningsArrivedListener>());
|
||||
|
||||
static {
|
||||
|
@ -208,9 +210,25 @@ public class CurrentWarnings {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Singleton constructor.
|
||||
*
|
||||
* @param officeId
|
||||
*/
|
||||
private CurrentWarnings(String officeId) {
|
||||
this.officeId = officeId;
|
||||
initializeData();
|
||||
|
||||
// This assumes the instances stays around for the life of the JVM.
|
||||
ISimulatedTimeChangeListener changeListener = new ISimulatedTimeChangeListener() {
|
||||
|
||||
@Override
|
||||
public void timechanged() {
|
||||
initializeData();
|
||||
}
|
||||
};
|
||||
SimulatedTime.getSystemTime().addSimulatedTimeChangeListener(
|
||||
changeListener);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -219,6 +237,10 @@ public class CurrentWarnings {
|
|||
private void initializeData() {
|
||||
Map<String, RequestConstraint> constraints = new HashMap<String, RequestConstraint>();
|
||||
constraints.put("officeid", new RequestConstraint(officeId));
|
||||
Calendar time = TimeUtil.newCalendar();
|
||||
constraints.put("issueTime",
|
||||
new RequestConstraint(TimeUtil.formatDate(time),
|
||||
ConstraintType.LESS_THAN_EQUALS));
|
||||
|
||||
long t0 = System.currentTimeMillis();
|
||||
List<AbstractWarningRecord> warnings = requestRecords(constraints);
|
||||
|
|
|
@ -20,8 +20,8 @@ import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
|||
import com.raytheon.uf.common.dataquery.responses.DbQueryResponse;
|
||||
import com.raytheon.uf.common.time.BinOffset;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.common.time.SimulatedTime;
|
||||
import com.raytheon.uf.common.time.TimeRange;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
|
||||
|
@ -40,6 +40,7 @@ import com.raytheon.viz.core.mode.CAVEMode;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 3, 2011 jsanchez Initial creation
|
||||
* Oct 25, 2013 2249 rferrel getAvailableTimes always returns a non-empty list.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -143,11 +144,19 @@ public class WWAResourceData extends AbstractRequestableResourceData {
|
|||
&& phenSig.getConstraintValue().contains(".A") ? getWatchStartTimes(warnings)
|
||||
: getWarningStartTimes(warnings);
|
||||
|
||||
if (SimulatedTime.getSystemTime().isRealTime()) {
|
||||
// Add the current time to the end of the array.
|
||||
startTimes
|
||||
.add(new DataTime(SimulatedTime.getSystemTime().getTime()));
|
||||
}
|
||||
// DR2249
|
||||
// When not in real time the commented code allows availableTimes to be
|
||||
// empty. This causes Null pointer exceptions when getting frames. If
|
||||
// always placing non-realtime causes other problems may want to add
|
||||
// only when startTimes is empty:
|
||||
// if (SimulatedTime.getSystemTime().isRealTime()) {
|
||||
// // Add the current time to the end of the array.
|
||||
// startTimes.add(new
|
||||
// DataTime(SimulatedTime.getSystemTime().getTime()));
|
||||
// }
|
||||
|
||||
// Add current configured system time.
|
||||
startTimes.add(new DataTime(TimeUtil.newDate()));
|
||||
|
||||
DataTime[] availableTimes = startTimes.toArray(new DataTime[startTimes
|
||||
.size()]);
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
<classpathentry exported="true" kind="lib" path="asm-3.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="boilerpipe-1.1.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="commons-codec-1.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="commons-compress-1.3.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="commons-logging-1.1.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="geronimo-stax-api_1.0_spec-1.0.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="httpclient-4.1.2.jar"/>
|
||||
|
|
|
@ -10,7 +10,6 @@ Bundle-ClassPath: apache-mime4j-core-0.7.jar,
|
|||
asm-3.1.jar,
|
||||
boilerpipe-1.1.0.jar,
|
||||
commons-codec-1.5.jar,
|
||||
commons-compress-1.3.jar,
|
||||
commons-logging-1.1.1.jar,
|
||||
geronimo-stax-api_1.0_spec-1.0.1.jar,
|
||||
httpclient-4.1.2.jar,
|
||||
|
@ -22,7 +21,8 @@ Bundle-ClassPath: apache-mime4j-core-0.7.jar,
|
|||
tika-parsers-1.0.jar,
|
||||
.
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
org.apache.log4j
|
||||
org.apache.log4j,
|
||||
org.apache.commons.compress;bundle-version="1.5.0"
|
||||
Export-Package: com.drew.imaging,
|
||||
com.drew.imaging.jpeg,
|
||||
com.drew.imaging.tiff,
|
||||
|
@ -100,19 +100,6 @@ Export-Package: com.drew.imaging,
|
|||
org.apache.commons.codec.digest,
|
||||
org.apache.commons.codec.language,
|
||||
org.apache.commons.codec.net,
|
||||
org.apache.commons.compress.archivers,
|
||||
org.apache.commons.compress.archivers.ar,
|
||||
org.apache.commons.compress.archivers.cpio,
|
||||
org.apache.commons.compress.archivers.dump,
|
||||
org.apache.commons.compress.archivers.jar,
|
||||
org.apache.commons.compress.archivers.tar,
|
||||
org.apache.commons.compress.archivers.zip,
|
||||
org.apache.commons.compress.changes,
|
||||
org.apache.commons.compress.compressors,
|
||||
org.apache.commons.compress.compressors.bzip2,
|
||||
org.apache.commons.compress.compressors.gzip,
|
||||
org.apache.commons.compress.compressors.pack200,
|
||||
org.apache.commons.compress.utils,
|
||||
org.apache.commons.logging,
|
||||
org.apache.commons.logging.impl,
|
||||
org.apache.http,
|
||||
|
|
|
@ -6,7 +6,6 @@ bin.includes = META-INF/,\
|
|||
apache-mime4j-dom-0.7.jar,\
|
||||
asm-3.1.jar,\
|
||||
boilerpipe-1.1.0.jar,\
|
||||
commons-compress-1.3.jar,\
|
||||
commons-logging-1.1.1.jar,\
|
||||
commons-codec-1.5.jar,\
|
||||
geronimo-stax-api_1.0_spec-1.0.1.jar,\
|
||||
|
|
Binary file not shown.
7
cots/org.apache.commons.compress/.classpath
Normal file
7
cots/org.apache.commons.compress/.classpath
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry exported="true" kind="lib" path="commons-compress-1.5.jar" sourcepath="commons-compress-1.5-sources.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
28
cots/org.apache.commons.compress/.project
Normal file
28
cots/org.apache.commons.compress/.project
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.apache.commons.compress</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,7 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
21
cots/org.apache.commons.compress/META-INF/MANIFEST.MF
Normal file
21
cots/org.apache.commons.compress/META-INF/MANIFEST.MF
Normal file
|
@ -0,0 +1,21 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Compress
|
||||
Bundle-SymbolicName: org.apache.commons.compress
|
||||
Bundle-Version: 1.5
|
||||
Bundle-Vendor: Apache
|
||||
Export-Package: org.apache.commons.compress.archivers,
|
||||
org.apache.commons.compress.archivers.ar,
|
||||
org.apache.commons.compress.archivers.cpio,
|
||||
org.apache.commons.compress.archivers.dump,
|
||||
org.apache.commons.compress.archivers.jar,
|
||||
org.apache.commons.compress.archivers.tar,
|
||||
org.apache.commons.compress.archivers.zip,
|
||||
org.apache.commons.compress.changes,
|
||||
org.apache.commons.compress.compressors,
|
||||
org.apache.commons.compress.compressors.bzip2,
|
||||
org.apache.commons.compress.compressors.gzip,
|
||||
org.apache.commons.compress.compressors.pack200,
|
||||
org.apache.commons.compress.compressors.xz,
|
||||
org.apache.commons.compress.utils
|
||||
Bundle-ClassPath: commons-compress-1.5.jar
|
2
cots/org.apache.commons.compress/build.properties
Normal file
2
cots/org.apache.commons.compress/build.properties
Normal file
|
@ -0,0 +1,2 @@
|
|||
bin.includes = META-INF/,\
|
||||
commons-compress-1.5.jar
|
Binary file not shown.
Binary file not shown.
BIN
cots/org.apache.commons.compress/commons-compress-1.5.jar
Normal file
BIN
cots/org.apache.commons.compress/commons-compress-1.5.jar
Normal file
Binary file not shown.
|
@ -47,6 +47,7 @@ export EBXML_REGISTRY_FEDERATION_ENABLED=false
|
|||
export HTTP_PORT=9581
|
||||
export HTTP_SERVER=http://localhost:${HTTP_PORT}/services
|
||||
export JMS_SERVER=tcp://localhost:5672
|
||||
export JMS_VIRTUALHOST=edex
|
||||
export RADAR_SERVER=tcp://localhost:8813
|
||||
export DATADELIVERY_SERVER=http://${DATADELIVERY_HOST}:${DATADELIVERY_PORT}/services
|
||||
export EBXML_REGISTRY_SERVICE=http://${EBXML_REGISTRY_HOST}:${EBXML_REGISTRY_PORT}/services
|
||||
|
|
|
@ -113,6 +113,58 @@
|
|||
<exclude>cpgsrv-spring.xml</exclude>
|
||||
<exclude>.*sbn-simulator.*</exclude>
|
||||
</mode>
|
||||
<mode name="ingestHydro">
|
||||
<include>distribution-spring.xml</include>
|
||||
<include>manualIngest-common.xml</include>
|
||||
<include>manualIngest-spring.xml</include>
|
||||
<include>shef-ingest.xml</include>
|
||||
<include>shef-common.xml</include>
|
||||
<include>ohd-common.xml</include>
|
||||
<include>alarmWhfs-spring.xml</include>
|
||||
<include>arealffgGenerator-spring.xml</include>
|
||||
<include>arealQpeGen-spring.xml</include>
|
||||
<include>DPADecoder-spring.xml</include>
|
||||
<include>dqcPreprocessor-spring.xml</include>
|
||||
<include>floodArchiver-spring.xml</include>
|
||||
<include>freezingLevel-spring.xml</include>
|
||||
<include>hpeDHRDecoder-spring.xml</include>
|
||||
<include>ihfsDbPurge-spring.xml</include>
|
||||
<include>logFilePurger-spring.xml</include>
|
||||
<include>mpeFieldgen-spring.xml</include>
|
||||
<include>mpeHpeFilePurge-spring.xml</include>
|
||||
<include>mpeLightningSrv-ingest.xml</include>
|
||||
<include>mpeProcessGrib-spring.xml</include>
|
||||
<include>ohdSetupService-spring.xml</include>
|
||||
<include>pointDataRetrievel-spring.xml</include>
|
||||
<include>q2FileProcessor-spring.xml</include>
|
||||
<include>satpre-spring.xml</include>
|
||||
<include>purge-logs.xml</include>
|
||||
</mode>
|
||||
<mode name="requestHydro">
|
||||
<include>ohd-common.xml</include>
|
||||
<include>database-common.xml</include>
|
||||
<include>ohd-request.xml</include>
|
||||
<include>alertviz-request.xml</include>
|
||||
<include>auth-common.xml</include>
|
||||
<include>auth-request.xml</include>
|
||||
<include>menus-request.xml</include>
|
||||
<include>utility-request.xml</include>
|
||||
<include>management-common.xml</include>
|
||||
<include>management-request.xml</include>
|
||||
<include>manualIngest-common.xml</include>
|
||||
<include>manualIngest-request.xml</include>
|
||||
<include>nwsauth-request.xml</include>
|
||||
<include>persist-request.xml</include>
|
||||
<include>site-common.xml</include>
|
||||
<include>site-request.xml</include>
|
||||
<include>time-common.xml</include>
|
||||
<include>units-common.xml</include>
|
||||
<include>useradmin-common.xml</include>
|
||||
<include>useradmin-request.xml</include>
|
||||
<include>event-common.xml</include>
|
||||
<include>eventbus-common.xml</include>
|
||||
<include>edex-request.xml</include>
|
||||
</mode>
|
||||
<mode name="ingestGrib">
|
||||
<include>time-common.xml</include>
|
||||
<include>auth-common.xml</include>
|
||||
|
@ -225,7 +277,6 @@
|
|||
<include>time-common.xml</include>
|
||||
<include>auth-common.xml</include>
|
||||
<include>nwsauth-request.xml</include>
|
||||
<include>grid-staticdata-process.xml</include>
|
||||
<include>grid-common.xml</include>
|
||||
<include>gridcoverage-.*.xml</include>
|
||||
<include>parameter-common.xml</include>
|
||||
|
@ -351,7 +402,6 @@
|
|||
<include>obs-ogc.xml</include>-->
|
||||
<!-- grid specific services
|
||||
<include>grib-common.xml</include>
|
||||
<include>grid-staticdata-process.xml</include>
|
||||
<include>gridcoverage-.*.xml</include>
|
||||
<include>grib-distribution.xml</include>
|
||||
<include>level-common.xml</include>
|
||||
|
|
|
@ -12,10 +12,6 @@ qc.cron=0+2,7,12,17,22,27,32,37,42,47,52,57+*+*+*+?
|
|||
acarssounding.cron=00+10,30,50+*+*+*+?
|
||||
gfe.cron=0+15+*+*+*+?
|
||||
repack.cron=0+20+*+*+*+?
|
||||
# runs database and hdf5 archive for archive server to pull data from
|
||||
archive.cron=0+40+*+*+*+?
|
||||
# purge archives
|
||||
archive.purge.cron=0+0+*+*+*+?
|
||||
|
||||
###purge configuration
|
||||
# Interval at which the purge job kicks off
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<!-- specify the connection to the broker (qpid) -->
|
||||
<!-- MaxPrefetch set at 0, due to DataPool routers getting messages backed up behind long running tasks -->
|
||||
<bean id="amqConnectionFactory" class="org.apache.qpid.client.AMQConnectionFactory">
|
||||
<constructor-arg type="java.lang.String" value="amqp://guest:guest@/edex?brokerlist='tcp://${BROKER_ADDR}?retries='9999'&connecttimeout='5000'&connectdelay='5000''&maxprefetch='0'&sync_publish='all'&sync_ack='true'"/>
|
||||
<constructor-arg type="java.lang.String" value="amqp://guest:guest@/${JMS_VIRTUALHOST}?brokerlist='tcp://${BROKER_ADDR}?retries='9999'&connecttimeout='5000'&connectdelay='5000''&maxprefetch='0'&sync_publish='all'&sync_ack='true'"/>
|
||||
</bean>
|
||||
|
||||
<bean id="jmsPooledConnectionFactory" class="com.raytheon.uf.common.jms.JmsPooledConnectionFactory">
|
||||
|
|
|
@ -198,10 +198,4 @@
|
|||
</sortBy>
|
||||
</pointSource>
|
||||
|
||||
<!-- Include Various geospatial XML files to create their objects. These are *NOT*
|
||||
turned on unless the corresponding .vm file is turned on in a given template's .vm file
|
||||
-->
|
||||
<include file="mileMarkers.xml"/>
|
||||
<!-- To enable, make sure mileMarkers.vm is added/uncommented in a WarnGen template's .vm file -->
|
||||
<include file="pointMarkers.xml"/>
|
||||
<!-- To enable, make sure pointMarkers.vm is added/uncommented in a WarnGen template's .vm file -->
|
||||
|
||||
|
|
29
edexOsgi/build.edex/esb/etc/ingestHydro.sh
Normal file
29
edexOsgi/build.edex/esb/etc/ingestHydro.sh
Normal file
|
@ -0,0 +1,29 @@
|
|||
#!/bin/bash
|
||||
##
|
||||
# This software was developed and / or modified by Raytheon Company,
|
||||
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
#
|
||||
# U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
# This software product contains export-restricted data whose
|
||||
# export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
# to non-U.S. persons whether in the United States or abroad requires
|
||||
# an export license or other authorization.
|
||||
#
|
||||
# Contractor Name: Raytheon Company
|
||||
# Contractor Address: 6825 Pine Street, Suite 340
|
||||
# Mail Stop B8
|
||||
# Omaha, NE 68106
|
||||
# 402.291.0100
|
||||
#
|
||||
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
# further licensing information.
|
||||
##
|
||||
|
||||
export INIT_MEM=412 # in Meg
|
||||
export MAX_MEM=796 # in Meg
|
||||
|
||||
export METADATA_POOL_MIN=4
|
||||
export EDEX_DEBUG_PORT=5006
|
||||
export EDEX_JMX_PORT=1617
|
||||
export LOG4J_CONF=log4j-ingest.xml
|
||||
export MGMT_PORT=9602
|
36
edexOsgi/build.edex/esb/etc/requestHydro.sh
Normal file
36
edexOsgi/build.edex/esb/etc/requestHydro.sh
Normal file
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
##
|
||||
# This software was developed and / or modified by Raytheon Company,
|
||||
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
#
|
||||
# U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
# This software product contains export-restricted data whose
|
||||
# export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
# to non-U.S. persons whether in the United States or abroad requires
|
||||
# an export license or other authorization.
|
||||
#
|
||||
# Contractor Name: Raytheon Company
|
||||
# Contractor Address: 6825 Pine Street, Suite 340
|
||||
# Mail Stop B8
|
||||
# Omaha, NE 68106
|
||||
# 402.291.0100
|
||||
#
|
||||
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
# further licensing information.
|
||||
##
|
||||
export INIT_MEM=128 # in Meg
|
||||
if [ "$EDEX_ARCH" == "64-bit" ]; then
|
||||
export MAX_MEM=1648 # in Meg
|
||||
else
|
||||
export MAX_MEM=880 # in Meg
|
||||
fi
|
||||
export SERIALIZE_POOL_MAX_SIZE=24
|
||||
export SERIALIZE_STREAM_INIT_SIZE_MB=2
|
||||
export SERIALIZE_STREAM_MAX_SIZE_MB=8
|
||||
|
||||
|
||||
export JMS_POOL_MIN=8
|
||||
export JMS_POOL_MAX=24
|
||||
export EDEX_DEBUG_PORT=5005
|
||||
export EDEX_JMX_PORT=1616
|
||||
export MGMT_PORT=9601
|
|
@ -47,19 +47,18 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
|
|||
* }
|
||||
* </code>
|
||||
*
|
||||
*
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 20080103 384 jkorman Initial Coding.
|
||||
* 20080408 1039 jkorman Added traceId for tracing data.
|
||||
* 11/11/08 1684 chammack Camel Refactor
|
||||
* ======================================
|
||||
* AWIPS2 DR Work
|
||||
* 20120911 1011 jkorman Added decode of AIREP turbulence.
|
||||
* Jan 03, 2008 384 jkorman Initial Coding.
|
||||
* Apr 08, 2008 1039 jkorman Added traceId for tracing data.
|
||||
* Nov 11, 2008 1684 chammack Camel Refactor
|
||||
* Sep 11, 2012 1011 jkorman Added decode of AIREP turbulence.
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
* </pre>
|
||||
*
|
||||
* @author jkorman
|
||||
|
@ -103,19 +102,19 @@ public class AirepDecoder extends AbstractDecoder {
|
|||
|
||||
try {
|
||||
WMOHeader wmoHeader = input.wmoHeader;
|
||||
if(wmoHeader != null) {
|
||||
if (wmoHeader != null) {
|
||||
traceId = wmoHeader.getWmoHeader().replace(" ", "_");
|
||||
logger.info(traceId + "- AirepDecoder.decode()");
|
||||
|
||||
Calendar refTime = TimeTools.findDataTime(
|
||||
wmoHeader.getYYGGgg(), header);
|
||||
if(refTime != null) {
|
||||
report = populateRecord(new AirepParser(input.report, refTime));
|
||||
if (refTime != null) {
|
||||
report = populateRecord(new AirepParser(input.report,
|
||||
refTime));
|
||||
}
|
||||
}
|
||||
if (report != null) {
|
||||
report.setTraceId(traceId);
|
||||
report.setPluginName(PLUGIN_NAME);
|
||||
try {
|
||||
report.constructDataURI();
|
||||
} catch (PluginException e) {
|
||||
|
@ -182,17 +181,17 @@ public class AirepDecoder extends AbstractDecoder {
|
|||
}
|
||||
AirepParser.Turbulence turb = parser.getTurbulence();
|
||||
int t = -1;
|
||||
if(turb != null) {
|
||||
if (turb != null) {
|
||||
t = turb.getTurbulence() << 4;
|
||||
}
|
||||
if(flightConditions > -1) {
|
||||
if(t > -1) {
|
||||
if (flightConditions > -1) {
|
||||
if (t > -1) {
|
||||
record.setFlightConditions(flightConditions | t);
|
||||
} else {
|
||||
record.setFlightConditions(flightConditions);
|
||||
}
|
||||
} else {
|
||||
if(t > -1) {
|
||||
if (t > -1) {
|
||||
record.setFlightConditions(t);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,18 +64,21 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 20070810 379 jkorman Initial Coding from prototype.
|
||||
* 20070817 379 jkorman Changed log info to debug in decode().
|
||||
* 20070821 379 jkorman Added SFPA41 lightning data pattern.
|
||||
* 20070912 379 jkorman Code review cleanup.
|
||||
* 20070920 379 jkorman Check for null persistence time.
|
||||
* 20070924 379 jkorman Removed HDFGroup code. Set insert_time
|
||||
* Aug 10, 2007 379 jkorman Initial Coding from prototype.
|
||||
* Aug 17, 2007 379 jkorman Changed log info to debug in decode().
|
||||
* Aug 21, 2007 379 jkorman Added SFPA41 lightning data pattern.
|
||||
* Sep 12, 2007 379 jkorman Code review cleanup.
|
||||
* Sep 20, 2007 379 jkorman Check for null persistence time.
|
||||
* Sep 24, 2007 379 jkorman Removed HDFGroup code. Set insert_time
|
||||
* directly in decode.
|
||||
* 20070926 379 jkorman Updated to set DataTime.
|
||||
* 20080318 1026 jkorman Added debug strike info.
|
||||
* 20080408 1039 jkorman Added traceId for tracing data.
|
||||
* 11/11/08 1684 chammack Refactored for camel integration
|
||||
* 20130503 DCS 112 Wufeng Zhou Modified to be able to handle both the new encrypted data and legacy bit-shifted data
|
||||
* Sep 26, 2007 379 jkorman Updated to set DataTime.
|
||||
* Mar 18, 2008 1026 jkorman Added debug strike info.
|
||||
* Apr 08, 2008 1039 jkorman Added traceId for tracing data.
|
||||
* Nov 11, 2008 1684 chammack Refactored for camel integration
|
||||
* May 03, 2013 DCS 112 Wufeng Zhou Modified to be able to handle both the
|
||||
* new encrypted data and legacy bit-shifted
|
||||
* data
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -90,9 +93,9 @@ public class BinLightningDecoder extends AbstractDecoder {
|
|||
// Allow ingest up to 10 minutes into the future.
|
||||
private static final long TEN_MINUTES = 10 * 60 * 1000L;
|
||||
|
||||
private SimpleDateFormat SDF;
|
||||
private final SimpleDateFormat SDF;
|
||||
|
||||
private Log logger = LogFactory.getLog(getClass());
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
/**
|
||||
* Default lightning strike type for FLASH messages. RT_FLASH documents
|
||||
|
@ -101,7 +104,7 @@ public class BinLightningDecoder extends AbstractDecoder {
|
|||
public LtgStrikeType DEFAULT_FLASH_TYPE = LtgStrikeType.STRIKE_CG;
|
||||
|
||||
private String traceId = null;
|
||||
|
||||
|
||||
/**
|
||||
* Construct a BinLightning decoder. Calling hasNext() after construction
|
||||
* will return false, decode() will return a null.
|
||||
|
@ -118,9 +121,10 @@ public class BinLightningDecoder extends AbstractDecoder {
|
|||
* @throws DecoderException
|
||||
* Thrown if no data is available.
|
||||
*/
|
||||
public PluginDataObject[] decode(byte[] data, Headers headers) throws DecoderException {
|
||||
public PluginDataObject[] decode(byte[] data, Headers headers)
|
||||
throws DecoderException {
|
||||
|
||||
//String traceId = null;
|
||||
// String traceId = null;
|
||||
PluginDataObject[] reports = new PluginDataObject[0];
|
||||
|
||||
if (data != null) {
|
||||
|
@ -131,43 +135,56 @@ public class BinLightningDecoder extends AbstractDecoder {
|
|||
|
||||
Calendar baseTime = TimeTools.findDataTime(wmoHdr.getYYGGgg(),
|
||||
headers);
|
||||
|
||||
// Because binary nature of the encrypted data, the string created with its byte[] array may not have the same length of the byte[] array length
|
||||
// So when DecoderTools.stripWMOHeader() assumes byte[] length == String length in it logic, it is observed that it may return a shorter byte[] than
|
||||
// the real data array. (Looks like a bug???)
|
||||
// byte[] pdata = DecoderTools.stripWMOHeader(data, SFUS_PATTERN);
|
||||
// if (pdata == null) {
|
||||
// pdata = DecoderTools.stripWMOHeader(data, SFPA_PATTERN);
|
||||
// }
|
||||
// instead the following is used to strip WMO header a little more safely.
|
||||
|
||||
// Because binary nature of the encrypted data, the string
|
||||
// created with its byte[] array may not have the same length of
|
||||
// the byte[] array length
|
||||
// So when DecoderTools.stripWMOHeader() assumes byte[] length
|
||||
// == String length in it logic, it is observed that it may
|
||||
// return a shorter byte[] than
|
||||
// the real data array. (Looks like a bug???)
|
||||
// byte[] pdata = DecoderTools.stripWMOHeader(data,
|
||||
// SFUS_PATTERN);
|
||||
// if (pdata == null) {
|
||||
// pdata = DecoderTools.stripWMOHeader(data, SFPA_PATTERN);
|
||||
// }
|
||||
// instead the following is used to strip WMO header a little
|
||||
// more safely.
|
||||
byte[] pdata = null;
|
||||
if (wmoHdr.isValid() && wmoHdr.getMessageDataStart() > 0) {
|
||||
pdata = new byte[data.length - wmoHdr.getMessageDataStart()];
|
||||
System.arraycopy(data, wmoHdr.getMessageDataStart(), pdata, 0, data.length - wmoHdr.getMessageDataStart());
|
||||
}
|
||||
|
||||
if (wmoHdr.isValid() && (wmoHdr.getMessageDataStart() > 0)) {
|
||||
pdata = new byte[data.length - wmoHdr.getMessageDataStart()];
|
||||
System.arraycopy(data, wmoHdr.getMessageDataStart(), pdata,
|
||||
0, data.length - wmoHdr.getMessageDataStart());
|
||||
}
|
||||
|
||||
if ((pdata == null) || (pdata.length == 0)) {
|
||||
return new PluginDataObject[0];
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Modified by Wufeng Zhou to handle both legacy bit-shifted and new encryted data
|
||||
// Modified by Wufeng Zhou to handle both legacy bit-shifted and
|
||||
// new encryted data
|
||||
//
|
||||
// Preserved the legacy decoding in BinLigntningDecoderUtil.decodeBitShiftedBinLightningData(), and added logic to process
|
||||
// both encrypted data and legacy data
|
||||
//
|
||||
|
||||
List<LightningStrikePoint> strikes = BinLigntningDecoderUtil.decodeBinLightningData(data, pdata, traceId, baseTime.getTime());
|
||||
// Preserved the legacy decoding in
|
||||
// BinLigntningDecoderUtil.decodeBitShiftedBinLightningData(),
|
||||
// and added logic to process
|
||||
// both encrypted data and legacy data
|
||||
//
|
||||
|
||||
List<LightningStrikePoint> strikes = BinLigntningDecoderUtil
|
||||
.decodeBinLightningData(data, pdata, traceId,
|
||||
baseTime.getTime());
|
||||
|
||||
if (strikes == null) { // keep-alive record, log and return
|
||||
logger.info(traceId + " - found keep-alive record. ignore for now.");
|
||||
return reports;
|
||||
logger.info(traceId
|
||||
+ " - found keep-alive record. ignore for now.");
|
||||
return reports;
|
||||
}
|
||||
|
||||
//
|
||||
// Done MOD by Wufeng Zhou
|
||||
//
|
||||
|
||||
|
||||
// post processing data - if not keep-alive record
|
||||
BinLightningRecord report = null;
|
||||
if (strikes.size() > 0) {
|
||||
|
@ -182,22 +199,22 @@ public class BinLightningDecoder extends AbstractDecoder {
|
|||
|
||||
Calendar c = TimeTools.copy(baseTime);
|
||||
if (c == null) {
|
||||
throw new DecoderException(traceId + " - Error decoding times");
|
||||
throw new DecoderException(traceId
|
||||
+ " - Error decoding times");
|
||||
}
|
||||
//report.setInsertTime(c); // OB13.4 source code does not have this line anymore, WZ 05/03/2013
|
||||
// report.setInsertTime(c); // OB13.4 source code does not have
|
||||
// this line anymore, WZ 05/03/2013
|
||||
|
||||
Calendar cStart = report.getStartTime();
|
||||
if (cStart.getTimeInMillis() > c.getTimeInMillis()
|
||||
+ TEN_MINUTES) {
|
||||
synchronized (SDF) {
|
||||
logger.info("Discarding future data for " + traceId
|
||||
+ " at " + SDF.format(cStart.getTime()));
|
||||
}
|
||||
if (cStart.getTimeInMillis() > (c.getTimeInMillis() + TEN_MINUTES)) {
|
||||
synchronized (SDF) {
|
||||
logger.info("Discarding future data for " + traceId
|
||||
+ " at " + SDF.format(cStart.getTime()));
|
||||
}
|
||||
} else {
|
||||
Calendar cStop = report.getStopTime();
|
||||
|
||||
TimeRange range = new TimeRange(
|
||||
cStart.getTimeInMillis(),
|
||||
TimeRange range = new TimeRange(cStart.getTimeInMillis(),
|
||||
cStop.getTimeInMillis());
|
||||
|
||||
DataTime dataTime = new DataTime(cStart, range);
|
||||
|
@ -205,19 +222,19 @@ public class BinLightningDecoder extends AbstractDecoder {
|
|||
|
||||
if (report != null) {
|
||||
report.setTraceId(traceId);
|
||||
report.setPluginName("binlightning");
|
||||
try {
|
||||
report.constructDataURI();
|
||||
reports = new PluginDataObject[] { report };
|
||||
} catch (PluginException e) {
|
||||
logger.error("Error constructing datauri", e);
|
||||
throw new DecoderException("Error constructing datauri", e);
|
||||
logger.error("Error constructing datauri", e);
|
||||
throw new DecoderException(
|
||||
"Error constructing datauri", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.error("No WMOHeader found in data");
|
||||
logger.error("No WMOHeader found in data");
|
||||
}
|
||||
return reports;
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
* May 02, 2013 1970 bgonzale Removed Table annotation, changed from
|
||||
* Entity annotation to MappedSuperClass.
|
||||
* May 14, 2013 1869 bsteffen Remove DataURI column from bufrmos.
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -75,123 +76,126 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
public abstract class BufrMosData extends PersistablePluginDataObject implements
|
||||
IPersistable, IPointData {
|
||||
|
||||
public static enum MOSType {
|
||||
ETA, GFS, AVN, LAMP, HPC, MRF, NGM
|
||||
};
|
||||
public static enum MOSType {
|
||||
ETA, GFS, AVN, LAMP, HPC, MRF, NGM
|
||||
};
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static final String MOS_DATA = "Data";
|
||||
public static final String MOS_DATA = "Data";
|
||||
|
||||
// Text of the WMO header
|
||||
@Transient
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private String wmoHeader;
|
||||
// Text of the WMO header
|
||||
@Transient
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private String wmoHeader;
|
||||
|
||||
@Embedded
|
||||
@DynamicSerializeElement
|
||||
private PointDataView pointDataView = null;
|
||||
@Embedded
|
||||
@DynamicSerializeElement
|
||||
private PointDataView pointDataView = null;
|
||||
|
||||
@ManyToOne(cascade = { CascadeType.REFRESH })
|
||||
@PrimaryKeyJoinColumn
|
||||
@DataURI(position = 1, embedded = true)
|
||||
@XmlElement
|
||||
@DynamicSerializeElement
|
||||
private BufrMosDataLocation location;
|
||||
@ManyToOne(cascade = { CascadeType.REFRESH })
|
||||
@PrimaryKeyJoinColumn
|
||||
@DataURI(position = 1, embedded = true)
|
||||
@XmlElement
|
||||
@DynamicSerializeElement
|
||||
private BufrMosDataLocation location;
|
||||
|
||||
/**
|
||||
* Create an empty MOSData object.
|
||||
*/
|
||||
public BufrMosData() {
|
||||
this.pluginName = "bufrmos" + getType();
|
||||
}
|
||||
/**
|
||||
* Create an empty MOSData object.
|
||||
*/
|
||||
public BufrMosData() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for DataURI construction through base class. This is used by
|
||||
* the notification service.
|
||||
*
|
||||
* @param uri
|
||||
* A data uri applicable to this class.
|
||||
* @param tableDef
|
||||
* The table definitions for this class.
|
||||
*/
|
||||
public BufrMosData(String uri) {
|
||||
super(uri);
|
||||
}
|
||||
/**
|
||||
* Constructor for DataURI construction through base class. This is used by
|
||||
* the notification service.
|
||||
*
|
||||
* @param uri
|
||||
* A data uri applicable to this class.
|
||||
* @param tableDef
|
||||
* The table definitions for this class.
|
||||
*/
|
||||
public BufrMosData(String uri) {
|
||||
super(uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the geometry latitude.
|
||||
*
|
||||
* @return The geometry latitude.
|
||||
*/
|
||||
public double getLatitude() {
|
||||
return location.getLatitude();
|
||||
}
|
||||
/**
|
||||
* Get the geometry latitude.
|
||||
*
|
||||
* @return The geometry latitude.
|
||||
*/
|
||||
public double getLatitude() {
|
||||
return location.getLatitude();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the geometry longitude.
|
||||
*
|
||||
* @return The geometry longitude.
|
||||
*/
|
||||
public double getLongitude() {
|
||||
return location.getLongitude();
|
||||
}
|
||||
/**
|
||||
* Get the geometry longitude.
|
||||
*
|
||||
* @return The geometry longitude.
|
||||
*/
|
||||
public double getLongitude() {
|
||||
return location.getLongitude();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the station identifier for this observation.
|
||||
*
|
||||
* @return the stationId
|
||||
*/
|
||||
public String getStationId() {
|
||||
return location.getStationId();
|
||||
}
|
||||
/**
|
||||
* Get the station identifier for this observation.
|
||||
*
|
||||
* @return the stationId
|
||||
*/
|
||||
public String getStationId() {
|
||||
return location.getStationId();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the type
|
||||
*/
|
||||
public abstract MOSType getType();
|
||||
/**
|
||||
* @return the type
|
||||
*/
|
||||
public abstract MOSType getType();
|
||||
|
||||
/**
|
||||
* @return the wmoHeader
|
||||
*/
|
||||
public String getWmoHeader() {
|
||||
return wmoHeader;
|
||||
}
|
||||
/**
|
||||
* @return the wmoHeader
|
||||
*/
|
||||
public String getWmoHeader() {
|
||||
return wmoHeader;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param wmoHeader
|
||||
* the wmoHeader to set
|
||||
*/
|
||||
public void setWmoHeader(String wmoHeader) {
|
||||
this.wmoHeader = wmoHeader;
|
||||
}
|
||||
/**
|
||||
* @param wmoHeader
|
||||
* the wmoHeader to set
|
||||
*/
|
||||
public void setWmoHeader(String wmoHeader) {
|
||||
this.wmoHeader = wmoHeader;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param dataURI
|
||||
*/
|
||||
@Override
|
||||
public void setDataURI(String dataURI) {
|
||||
identifier = dataURI;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param dataURI
|
||||
*/
|
||||
@Override
|
||||
public void setDataURI(String dataURI) {
|
||||
identifier = dataURI;
|
||||
}
|
||||
|
||||
public BufrMosDataLocation getLocation() {
|
||||
return location;
|
||||
}
|
||||
public BufrMosDataLocation getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(BufrMosDataLocation mosLocation) {
|
||||
this.location = mosLocation;
|
||||
}
|
||||
public void setLocation(BufrMosDataLocation mosLocation) {
|
||||
this.location = mosLocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PointDataView getPointDataView() {
|
||||
return this.pointDataView;
|
||||
}
|
||||
@Override
|
||||
public PointDataView getPointDataView() {
|
||||
return this.pointDataView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPointDataView(PointDataView pointDataView) {
|
||||
this.pointDataView = pointDataView;
|
||||
@Override
|
||||
public void setPointDataView(PointDataView pointDataView) {
|
||||
this.pointDataView = pointDataView;
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "bufrmos" + getType();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
|
|||
* Mar 03, 2008 969 jkorman Initial implementation.
|
||||
* May 09, 2013 1869 bsteffen Modified D2D time series of point data to
|
||||
* work without dataURI.
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -110,7 +111,6 @@ public abstract class AbstractBUFRUAAdapter extends BUFRPointDataAdapter<UAObs>
|
|||
|
||||
if ((obsData != null) && (wmoStaId != null)) {
|
||||
// pickup the data.
|
||||
obsData.setPluginName(getPluginName());
|
||||
obsData.setWmoHeader(wmoHeader.getWmoHeader());
|
||||
|
||||
Calendar validTime = obsData.getValidTime();
|
||||
|
|
|
@ -43,11 +43,12 @@ import com.vividsolutions.jts.io.WKTReader;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 03/03/2007 908 bwoodle initial creation
|
||||
* 12/03/2008 chammack Camel refactor
|
||||
* 09/15/2009 3027 njensen Patterns constants
|
||||
* 09/21/2009 3072 bsteffen Fixed Decoding of Line Records
|
||||
* 01/02/2013 DCS 135 tk handle coverage value Line records
|
||||
* Mar 03, 2007 908 bwoodle initial creation
|
||||
* Dec 03, 2008 chammack Camel refactor
|
||||
* Sep 15, 2009 3027 njensen Patterns constants
|
||||
* Sep 21, 2009 3072 bsteffen Fixed Decoding of Line Records
|
||||
* Jan 02, 2013 DCS 135 tk handle coverage value Line records
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -86,7 +87,8 @@ public class CcfpDecoder extends AbstractDecoder {
|
|||
|
||||
private static final String SPACE = " ";
|
||||
|
||||
private static final PluginDataObject [] EMPTY_PDO = new PluginDataObject [0];
|
||||
private static final PluginDataObject[] EMPTY_PDO = new PluginDataObject[0];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
@ -95,10 +97,11 @@ public class CcfpDecoder extends AbstractDecoder {
|
|||
public CcfpDecoder() throws DecoderException {
|
||||
}
|
||||
|
||||
public PluginDataObject[] decode(String msg, Headers headers) throws PluginException {
|
||||
public PluginDataObject[] decode(String msg, Headers headers)
|
||||
throws PluginException {
|
||||
|
||||
PluginDataObject[] data = null;
|
||||
|
||||
PluginDataObject [] data = null;
|
||||
|
||||
Calendar baseTime = null;
|
||||
WMOHeader wmoHdr = new WMOHeader(msg.getBytes());
|
||||
if (wmoHdr.isValid()) {
|
||||
|
@ -106,7 +109,7 @@ public class CcfpDecoder extends AbstractDecoder {
|
|||
} else {
|
||||
baseTime = TimeTools.getSystemCalendar();
|
||||
}
|
||||
|
||||
|
||||
CcfpRecord record = new CcfpRecord();
|
||||
record.setMessageData(msg);
|
||||
CcfpLocation location = new CcfpLocation();
|
||||
|
@ -116,18 +119,20 @@ public class CcfpDecoder extends AbstractDecoder {
|
|||
try {
|
||||
WKTReader wktReader = new WKTReader();
|
||||
if (matcher.find()) {
|
||||
Calendar start = TimeTools.getBaseCalendar(Integer
|
||||
.parseInt(matcher.group(1)), Integer.parseInt(matcher
|
||||
.group(2)), Integer.parseInt(matcher.group(3)));
|
||||
start.set(Calendar.HOUR_OF_DAY, Integer.parseInt(matcher
|
||||
.group(4)));
|
||||
Calendar valid = TimeTools.getBaseCalendar(Integer
|
||||
.parseInt(matcher.group(5)), Integer.parseInt(matcher
|
||||
.group(6)), Integer.parseInt(matcher.group(7)));
|
||||
valid.set(Calendar.HOUR_OF_DAY, Integer.parseInt(matcher
|
||||
.group(8)));
|
||||
TimeRange range = new TimeRange(start.getTime(), valid
|
||||
.getTime());
|
||||
Calendar start = TimeTools.getBaseCalendar(
|
||||
Integer.parseInt(matcher.group(1)),
|
||||
Integer.parseInt(matcher.group(2)),
|
||||
Integer.parseInt(matcher.group(3)));
|
||||
start.set(Calendar.HOUR_OF_DAY,
|
||||
Integer.parseInt(matcher.group(4)));
|
||||
Calendar valid = TimeTools.getBaseCalendar(
|
||||
Integer.parseInt(matcher.group(5)),
|
||||
Integer.parseInt(matcher.group(6)),
|
||||
Integer.parseInt(matcher.group(7)));
|
||||
valid.set(Calendar.HOUR_OF_DAY,
|
||||
Integer.parseInt(matcher.group(8)));
|
||||
TimeRange range = new TimeRange(start.getTime(),
|
||||
valid.getTime());
|
||||
record.setDataTime(new DataTime(start.getTime().getTime(),
|
||||
range));
|
||||
record.setProducttype(matcher.group(9));
|
||||
|
@ -147,8 +152,7 @@ public class CcfpDecoder extends AbstractDecoder {
|
|||
record.setTops(Integer.parseInt(matcher.group(4)));
|
||||
record.setSpeed(Integer.parseInt(matcher.group(5)));
|
||||
record.setDirection(Integer.parseInt(matcher.group(6)));
|
||||
location
|
||||
.setBoxLat(Double.parseDouble(matcher.group(8)) * 0.1);
|
||||
location.setBoxLat(Double.parseDouble(matcher.group(8)) * 0.1);
|
||||
location.setBoxLong(Double.parseDouble(matcher.group(9))
|
||||
* -0.1);
|
||||
String templatlonpairs = matcher.group(7);
|
||||
|
@ -157,8 +161,7 @@ public class CcfpDecoder extends AbstractDecoder {
|
|||
wtk.append("POLYGON((");
|
||||
if (matcher.find()) {
|
||||
wtk.append(Double.toString(Integer.parseInt(matcher
|
||||
.group(2))
|
||||
* -0.1));
|
||||
.group(2)) * -0.1));
|
||||
wtk.append(SPACE);
|
||||
wtk.append(Double.toString(Integer.parseInt(matcher
|
||||
.group(1)) * 0.1));
|
||||
|
@ -167,8 +170,7 @@ public class CcfpDecoder extends AbstractDecoder {
|
|||
wtk.append(COMMA);
|
||||
wtk.append(SPACE);
|
||||
wtk.append(Double.toString(Integer.parseInt(matcher
|
||||
.group(2))
|
||||
* -0.1));
|
||||
.group(2)) * -0.1));
|
||||
wtk.append(SPACE);
|
||||
wtk.append(Double.toString(Integer.parseInt(matcher
|
||||
.group(1)) * 0.1));
|
||||
|
@ -180,30 +182,30 @@ public class CcfpDecoder extends AbstractDecoder {
|
|||
} else if (record.getProducttype().equals("LINE")) {
|
||||
matcher = LINE_PATTERN.matcher(msg);
|
||||
if (matcher.find()) {
|
||||
record.setCoverage(Integer.parseInt(matcher.group(1))); // change to group 1
|
||||
// change to group 1
|
||||
record.setCoverage(Integer.parseInt(matcher.group(1)));
|
||||
record.setConf(null);
|
||||
record.setGrowth(null);
|
||||
record.setTops(null);
|
||||
record.setSpeed(null);
|
||||
record.setDirection(null);
|
||||
String templatlonpairs = matcher.group(2); // change to group 2
|
||||
// change to group 2
|
||||
String templatlonpairs = matcher.group(2);
|
||||
matcher = PAIR_PATTERN.matcher(templatlonpairs);
|
||||
|
||||
StringBuffer wtk = new StringBuffer();
|
||||
wtk.append("LINESTRING(");
|
||||
if (matcher.find()) {
|
||||
|
||||
Double lon = Integer.parseInt(matcher
|
||||
.group(2)) * -0.1;
|
||||
|
||||
Double lon = Integer.parseInt(matcher.group(2)) * -0.1;
|
||||
String lonStr = Double.toString(lon);
|
||||
|
||||
Double lat = Integer.parseInt(matcher
|
||||
.group(1)) * 0.1;
|
||||
Double lat = Integer.parseInt(matcher.group(1)) * 0.1;
|
||||
String latStr = Double.toString(lat);
|
||||
|
||||
location.setBoxLong(lon);
|
||||
location.setBoxLat(lat);
|
||||
|
||||
|
||||
wtk.append(lonStr);
|
||||
wtk.append(SPACE);
|
||||
wtk.append(latStr);
|
||||
|
@ -212,8 +214,7 @@ public class CcfpDecoder extends AbstractDecoder {
|
|||
wtk.append(COMMA);
|
||||
wtk.append(SPACE);
|
||||
wtk.append(Double.toString(Integer.parseInt(matcher
|
||||
.group(2))
|
||||
* -0.1));
|
||||
.group(2)) * -0.1));
|
||||
wtk.append(SPACE);
|
||||
wtk.append(Double.toString(Integer.parseInt(matcher
|
||||
.group(1)) * 0.1));
|
||||
|
@ -228,8 +229,7 @@ public class CcfpDecoder extends AbstractDecoder {
|
|||
logger.error("Unable to decode CCFP", e);
|
||||
}
|
||||
data = EMPTY_PDO;
|
||||
if(record != null) {
|
||||
record.setPluginName(PLUGIN_NAME);
|
||||
if (record != null) {
|
||||
try {
|
||||
record.constructDataURI();
|
||||
record.setInsertTime(baseTime);
|
||||
|
|
|
@ -51,13 +51,16 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 03/03/2007 908 bwoodle initial creation
|
||||
* 09/15/2009 3027 njensen Use dates for times
|
||||
* 09/21/2009 3072 bsteffen Removed times because they are stored in DataTime
|
||||
* Apr 4, 2013 1846 bkowal Added an index on refTime and forecastTime
|
||||
* Mar 03, 2007 908 bwoodle initial creation
|
||||
* Sep 15, 2009 3027 njensen Use dates for times
|
||||
* Sep 21, 2009 3072 bsteffen Removed times because they are stored in
|
||||
* DataTime
|
||||
* Apr 04, 2013 1846 bkowal Added an index on refTime and
|
||||
* forecastTime
|
||||
* Apr 12, 2013 1857 bgonzale Added SequenceGenerator annotation.
|
||||
* May 07, 2013 1869 bsteffen Remove dataURI column from
|
||||
* PluginDataObject.
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
|
@ -72,12 +75,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
* Both refTime and forecastTime are included in the refTimeIndex since
|
||||
* forecastTime is unlikely to be used.
|
||||
*/
|
||||
@org.hibernate.annotations.Table(
|
||||
appliesTo = "ccfp",
|
||||
indexes = {
|
||||
@Index(name = "ccfp_refTimeIndex", columnNames = { "refTime", "forecastTime" } )
|
||||
}
|
||||
)
|
||||
@org.hibernate.annotations.Table(appliesTo = "ccfp", indexes = { @Index(name = "ccfp_refTimeIndex", columnNames = {
|
||||
"refTime", "forecastTime" }) })
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@DynamicSerialize
|
||||
|
@ -299,4 +298,9 @@ public class CcfpRecord extends PluginDataObject implements ISpatialEnabled {
|
|||
public String getDataURI() {
|
||||
return super.getDataURI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "ccfp";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,14 +48,17 @@ import com.raytheon.uf.edex.plugin.grid.dao.GridDao;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 03/20/13 #1774 randerso Refactored out of GFEDao
|
||||
* 04/04/13 #1787 randerso Fixed to support changes to D2D grid location
|
||||
* Additional cleanup to move the D2D to GFE translation
|
||||
* 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
|
||||
* Mar 20, 2013 1774 randerso Refactored out of GFEDao
|
||||
* Apr 04, 2013 1787 randerso Fixed to support changes to D2D grid
|
||||
* location Additional cleanup to move the
|
||||
* D2D to GFE translation logic into
|
||||
* D2DGridDatabase.
|
||||
* May 03, 2013 1974 randerso Changed queryByParmId to look for parm
|
||||
* with duration suffix first.
|
||||
* May 22, 2013 1974 randerso Fix bug introduced by the previous fix
|
||||
* where query for T (T%hr) returned TP6hr
|
||||
* Jun 13, 2013 2044 randerso Cleaned up JavaDoc
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -135,7 +138,6 @@ public class GFED2DDao extends GridDao {
|
|||
|
||||
GridRecord retVal = (GridRecord) s.get(GridRecord.class,
|
||||
rawTimes.get(forecastTime));
|
||||
retVal.setPluginName(GridConstants.GRID);
|
||||
return retVal;
|
||||
|
||||
} finally {
|
||||
|
|
|
@ -95,6 +95,7 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery;
|
|||
* 05/20/13 #2127 rjpeter Set session's to read only and switched to stateless where possible.
|
||||
* 08/08/13 DR16485 ryu Remove call to getDatabaseId() from getMaxInsertTimeByDbId()
|
||||
* so new GFE databases aren't accidentally created.
|
||||
* 09/30/2013 #2147 rferrel Changes to archive hdf5 files.
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -106,6 +107,7 @@ public class GFEDao extends DefaultPluginDao {
|
|||
|
||||
public GFEDao() throws PluginException {
|
||||
super("gfe");
|
||||
this.pathProvider = new GFEPathProvider();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -115,6 +117,7 @@ public class GFEDao extends DefaultPluginDao {
|
|||
*/
|
||||
public GFEDao(String pluginName) throws PluginException {
|
||||
super(pluginName);
|
||||
this.pathProvider = new GFEPathProvider();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.edex.plugin.gfe.db.dao;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import com.raytheon.edex.plugin.gfe.server.database.GridDatabase;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GFERecord;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.util.GfeUtil;
|
||||
import com.raytheon.uf.common.dataplugin.persist.DefaultPathProvider;
|
||||
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
|
||||
|
||||
/**
|
||||
* Provider for GFE that uses the GfeUtil to get the HDF5 path and file names.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 23, 2013 rferrel Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author rferrel
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class GFEPathProvider extends DefaultPathProvider {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public GFEPathProvider() {
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.common.dataplugin.persist.DefaultPathProvider#getHDFFileName
|
||||
* (java.lang.String,
|
||||
* com.raytheon.uf.common.dataplugin.persist.IPersistable)
|
||||
*/
|
||||
@Override
|
||||
public String getHDFFileName(String pluginName, IPersistable persistable) {
|
||||
String name = null;
|
||||
if (persistable instanceof GFERecord) {
|
||||
GFERecord gfeRecord = (GFERecord) persistable;
|
||||
File hdf5File = GfeUtil.getHdf5File(GridDatabase.gfeBaseDataDir,
|
||||
gfeRecord.getParmId(), gfeRecord.getTimeRange());
|
||||
name = hdf5File.toString();
|
||||
name = name.substring(name.lastIndexOf(File.separator) + 1);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.common.dataplugin.persist.DefaultPathProvider#getHDFPath
|
||||
* (java.lang.String,
|
||||
* com.raytheon.uf.common.dataplugin.persist.IPersistable)
|
||||
*/
|
||||
@Override
|
||||
public String getHDFPath(String pluginName, IPersistable persistable) {
|
||||
String path = null;
|
||||
path = super.getHDFPath(pluginName, persistable);
|
||||
if (persistable instanceof GFERecord) {
|
||||
GFERecord gfeRecord = (GFERecord) persistable;
|
||||
File pathDir = GfeUtil.getHdf5Dir(GridDatabase.gfeBaseDataDir,
|
||||
gfeRecord.getDbId());
|
||||
path = pathDir.toString();
|
||||
path = path.substring(pluginName.length() + 1);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
}
|
|
@ -67,6 +67,7 @@ from com.raytheon.uf.common.localization import LocalizationContext_Localization
|
|||
# 05/23/13 1759 dgilling Remove unnecessary imports.
|
||||
# 07/25/13 2233 randerso Improved memory utilization and performance
|
||||
# 09/20/13 2405 dgilling Clip grids before inserting into cache.
|
||||
# 10/22/13 2405 rjpeter Remove WECache and store directly to cube.
|
||||
#
|
||||
#
|
||||
|
||||
|
@ -97,65 +98,98 @@ def logDebug(*msg):
|
|||
logVerbose(iscUtil.tupleToString(*msg))
|
||||
|
||||
|
||||
class WECache(object):
|
||||
def __init__(self, we, inv, clipArea):
|
||||
self._we = we
|
||||
self._clipArea = clipArea
|
||||
self._inv = OrderedDict()
|
||||
lst = list(inv)
|
||||
while len(lst):
|
||||
i = lst[:BATCH_WRITE_COUNT]
|
||||
javaTRs = ArrayList()
|
||||
for tr in i:
|
||||
javaTRs.add(iscUtil.toJavaTimeRange(tr))
|
||||
gridsAndHist = self._we.get(javaTRs, True)
|
||||
for idx, tr in enumerate(i):
|
||||
pair = gridsAndHist.get(idx)
|
||||
g = self.__encodeGridSlice(pair.getFirst(), clipArea)
|
||||
h = self.__encodeGridHistory(pair.getSecond())
|
||||
self._inv[tr] = (g, h)
|
||||
lst = lst[BATCH_WRITE_COUNT:]
|
||||
time.sleep(BATCH_DELAY)
|
||||
def retrieveData(we, inv, clipArea):
|
||||
lst = list(inv)
|
||||
trs=[]
|
||||
histDict = OrderedDict()
|
||||
cube = None
|
||||
keyList = None
|
||||
gridType = str(we.getGpi().getGridType())
|
||||
|
||||
def keys(self):
|
||||
return tuple(self._inv.keys())
|
||||
|
||||
def __getitem__(self, key):
|
||||
try:
|
||||
return self._inv[key]
|
||||
except KeyError:
|
||||
logEvent("Cache miss for key:", str(key))
|
||||
grid = self._we.getItem(iscUtil.toJavaTimeRange(key))
|
||||
pyGrid = self.__encodeGridSlice(grid, self._clipArea)
|
||||
history = grid.getGridDataHistory()
|
||||
pyHist = self.__encodeGridHistory(history)
|
||||
return (pyGrid, pyHist)
|
||||
# clipped size
|
||||
clipSize = (clipArea[1] - clipArea[0] + 1, clipArea[3] - clipArea[2] + 1)
|
||||
gridCount = len(inv)
|
||||
|
||||
def __encodeGridSlice(self, grid, clipArea):
|
||||
gridType = grid.getGridInfo().getGridType().toString()
|
||||
if gridType == "SCALAR":
|
||||
cube = numpy.empty(shape=(gridCount, clipSize[1], clipSize[0]), dtype=numpy.float32)
|
||||
elif gridType == "VECTOR":
|
||||
magCube = numpy.empty(shape=(gridCount, clipSize[1], clipSize[0]),dtype=numpy.float32)
|
||||
dirCube = numpy.empty(shape=(gridCount, clipSize[1], clipSize[0]),dtype=numpy.float32)
|
||||
cube = (magCube, dirCube)
|
||||
elif gridType == "WEATHER" or gridType == "DISCRETE":
|
||||
cube = numpy.empty(shape=(gridCount, clipSize[1], clipSize[0]), dtype=numpy.int8)
|
||||
keyList = []
|
||||
|
||||
cubeIdx = 0
|
||||
while len(lst):
|
||||
i = lst[:BATCH_WRITE_COUNT]
|
||||
javaTRs = ArrayList()
|
||||
for tr in i:
|
||||
javaTRs.add(iscUtil.toJavaTimeRange(tr))
|
||||
gridsAndHist = we.get(javaTRs, True)
|
||||
size = gridsAndHist.size()
|
||||
for idx in xrange(size):
|
||||
pair = gridsAndHist.get(idx)
|
||||
grid = pair.getFirst()
|
||||
tr = iscUtil.transformTime(grid.getValidTime())
|
||||
encodeGridSlice(grid, gridType, clipArea, cube, cubeIdx, keyList)
|
||||
cubeIdx += 1
|
||||
histDict[tr] = encodeGridHistory(pair.getSecond())
|
||||
lst = lst[BATCH_WRITE_COUNT:]
|
||||
time.sleep(BATCH_DELAY)
|
||||
|
||||
if len(histDict) != gridCount:
|
||||
# retrieved less grids than originally expected, purge ran?
|
||||
gridCount = len(histDict)
|
||||
|
||||
if gridType == "SCALAR":
|
||||
return clipToExtrema(grid.__numpy__[0], clipArea)
|
||||
oldCube = cube
|
||||
cube = numpy.empty(shape=(gridCount, clipSize[1], clipSize[0]), dtype=numpy.float32)
|
||||
for idx in xrange(gridCount):
|
||||
cube[idx] = oldCube[idx]
|
||||
elif gridType == "VECTOR":
|
||||
vecGrids = grid.__numpy__
|
||||
return (clipToExtrema(vecGrids[0], clipArea), clipToExtrema(vecGrids[1], clipArea))
|
||||
elif gridType == "WEATHER":
|
||||
keys = grid.getKeys()
|
||||
keyList = []
|
||||
for theKey in keys:
|
||||
keyList.append(theKey.toString())
|
||||
return (clipToExtrema(grid.__numpy__[0], clipArea), keyList)
|
||||
elif gridType =="DISCRETE":
|
||||
keys = grid.getKey()
|
||||
keyList = []
|
||||
for theKey in keys:
|
||||
keyList.append(theKey.toString())
|
||||
return (clipToExtrema(grid.__numpy__[0], clipArea), keyList)
|
||||
|
||||
def __encodeGridHistory(self, histories):
|
||||
retVal = []
|
||||
for i in xrange(histories.size()):
|
||||
retVal.append(histories.get(i).getCodedString())
|
||||
return tuple(retVal)
|
||||
oldMagCube = magCube
|
||||
magCube = numpy.empty(shape=(gridCount, clipSize[1], clipSize[0]),dtype=numpy.float32)
|
||||
oldDirCube = dirCube
|
||||
dirCube = numpy.empty(shape=(gridCount, clipSize[1], clipSize[0]),dtype=numpy.float32)
|
||||
cube = (magCube, dirCube)
|
||||
for idx in xrange(gridCount):
|
||||
magCube[idx] = oldMagCube[idx]
|
||||
dirCube[idx] = oldDirCube[idx]
|
||||
elif gridType == "WEATHER" or gridType == "DISCRETE":
|
||||
oldCube = cube
|
||||
cube = numpy.empty(shape=(gridCount, clipSize[1], clipSize[0]), dtype=numpy.int8)
|
||||
for idx in xrange(gridCount):
|
||||
cube[idx] = oldCube[idx]
|
||||
return (cube, histDict, keyList)
|
||||
|
||||
###-------------------------------------------------------------------------###
|
||||
### cube and keyList are out parameters to be filled by this method, idx is the index into cube to use
|
||||
def encodeGridSlice(grid, gridType, clipArea, cube, idx, keyList):
|
||||
if gridType == "SCALAR":
|
||||
cube[idx] = clipToExtrema(grid.__numpy__[0], clipArea)
|
||||
elif gridType == "VECTOR":
|
||||
vecGrids = grid.__numpy__
|
||||
cube[0][idx] = clipToExtrema(vecGrids[0], clipArea)
|
||||
cube[1][idx] = clipToExtrema(vecGrids[1], clipArea)
|
||||
elif gridType == "WEATHER" or gridType == "DISCRETE":
|
||||
if gridType == "DISCRETE":
|
||||
keys = grid.getKey()
|
||||
else:
|
||||
keys = grid.getKeys()
|
||||
gridKeys = []
|
||||
|
||||
for theKey in keys:
|
||||
gridKeys.append(theKey.toString())
|
||||
|
||||
keyList.append(gridKeys)
|
||||
cube[idx]= clipToExtrema(grid.__numpy__[0], clipArea)
|
||||
|
||||
def encodeGridHistory(histories):
|
||||
retVal = []
|
||||
for i in xrange(histories.size()):
|
||||
retVal.append(histories.get(i).getCodedString())
|
||||
return tuple(retVal)
|
||||
|
||||
|
||||
###-------------------------------------------------------------------------###
|
||||
|
@ -529,19 +563,18 @@ def storeTopoGrid(client, file, databaseID, invMask, clipArea):
|
|||
|
||||
###-------------------------------------------------------------------------###
|
||||
###
|
||||
def storeGridDataHistory(file, we, wec, trList):
|
||||
def storeGridDataHistory(file, we, histDict):
|
||||
"Stores the Grid Data history string for each grid in we."
|
||||
|
||||
# get the maximum size of the history string
|
||||
maxHistSize = 0
|
||||
histList = []
|
||||
for tr in trList:
|
||||
his = wec[tr][1]
|
||||
for (tr, his) in histDict.items():
|
||||
hisString = ''
|
||||
for i,h in enumerate(his):
|
||||
hisString = hisString + str(h)
|
||||
if i != len(his) - 1:
|
||||
hisString = hisString + " ^"
|
||||
hisString = hisString + " ^"
|
||||
histList.append(hisString)
|
||||
maxHistSize = max(maxHistSize,len(hisString))
|
||||
|
||||
|
@ -727,21 +760,17 @@ def storeScalarWE(we, trList, file, timeRange, databaseID,
|
|||
# get the data and store it in a Numeric array.
|
||||
timeList, overlappingTimes = findOverlappingTimes(trList, timeRange)
|
||||
|
||||
# clipped size
|
||||
clipSize = (clipArea[1] - clipArea[0] + 1, clipArea[3] - clipArea[2] + 1)
|
||||
gridCount = len(overlappingTimes)
|
||||
(cube, histDict, keyList) = retrieveData(we, overlappingTimes, clipArea)
|
||||
gridCount = len(cube)
|
||||
for i in xrange(len(overlappingTimes) -1, -1, -1):
|
||||
ot = overlappingTimes[i]
|
||||
if not ot in histDict:
|
||||
del overlappingTime[i]
|
||||
del timeList[i]
|
||||
elif we.getGpi().isRateParm():
|
||||
durRatio = (float(timeList[i][1]-timeList[i][0]))/float((ot[1]-ot[0]))
|
||||
cube[i] *= durRatio
|
||||
|
||||
cube = numpy.empty(shape=(gridCount, clipSize[1], clipSize[0]), dtype=numpy.float32)
|
||||
|
||||
wec = WECache(we, overlappingTimes, clipArea)
|
||||
for i,t in enumerate(overlappingTimes):
|
||||
grid = wec[t][0]
|
||||
#adjust for time changes
|
||||
if we.getGpi().isRateParm():
|
||||
durRatio = (float(timeList[i][1]-timeList[i][0]))/float((t[1]-t[0]))
|
||||
grid *= durRatio
|
||||
cube[i]= grid
|
||||
|
||||
### Make sure we found some grids
|
||||
# make the variable name
|
||||
varName = we.getParmid().getParmName() + "_" + we.getParmid().getParmLevel()
|
||||
|
@ -795,8 +824,8 @@ def storeScalarWE(we, trList, file, timeRange, databaseID,
|
|||
setattr(var, "fillValue", fillValue)
|
||||
|
||||
## Extract the GridDataHistory info and save it
|
||||
storeGridDataHistory(file, we, wec, overlappingTimes)
|
||||
|
||||
storeGridDataHistory(file, we, histDict)
|
||||
|
||||
logEvent("Saved", gridCount, varName, " grids")
|
||||
|
||||
return gridCount
|
||||
|
@ -811,23 +840,16 @@ def storeVectorWE(we, trList, file, timeRange,
|
|||
# get the data and store it in a Numeric array.
|
||||
timeList, overlappingTimes = findOverlappingTimes(trList, timeRange)
|
||||
|
||||
# clipped size
|
||||
clipSize = (clipArea[1] - clipArea[0] + 1, clipArea[3] - clipArea[2] + 1)
|
||||
gridCount = len(overlappingTimes)
|
||||
|
||||
magCube = numpy.empty(shape=(gridCount, clipSize[1], clipSize[0]),dtype=numpy.float32)
|
||||
dirCube = numpy.empty(shape=(gridCount, clipSize[1], clipSize[0]),dtype=numpy.float32)
|
||||
|
||||
wec = WECache(we, overlappingTimes, clipArea)
|
||||
for i,t in enumerate(overlappingTimes):
|
||||
vecData = wec[t][0]
|
||||
mag = vecData[0]
|
||||
dir = vecData[1]
|
||||
if we.getGpi().isRateParm():
|
||||
durRatio = (float(timeList[i][1]-timeList[i][0]))/float((t[1]-t[0]))
|
||||
mag *= durRatio
|
||||
magCube[i] = mag
|
||||
dirCube[i] = dir
|
||||
((magCube, dirCube), histDict, keyList) = retrieveData(we, overlappingTimes, clipArea)
|
||||
gridCount = len(magCube)
|
||||
for i in xrange(len(overlappingTimes) -1, -1, -1):
|
||||
ot = overlappingTimes[i]
|
||||
if not ot in histDict:
|
||||
del overlappingTime[i]
|
||||
del timeList[i]
|
||||
elif we.getGpi().isRateParm():
|
||||
durRatio = (float(timeList[i][1]-timeList[i][0]))/float((ot[1]-ot[0]))
|
||||
magCube[i] *= durRatio
|
||||
|
||||
varName = we.getParmid().getParmName() + "_" + we.getParmid().getParmLevel()
|
||||
|
||||
|
@ -924,8 +946,8 @@ def storeVectorWE(we, trList, file, timeRange,
|
|||
setattr(dirVar, "fillValue", dfillValue)
|
||||
|
||||
## Extract the GridDataHistory info and save it
|
||||
storeGridDataHistory(file, we, wec, overlappingTimes)
|
||||
|
||||
storeGridDataHistory(file, we, histDict)
|
||||
|
||||
logEvent("Saved", gridCount, varName, "grids")
|
||||
|
||||
return gridCount * 2 #vector has two grids
|
||||
|
@ -970,19 +992,14 @@ def storeWeatherWE(we, trList, file, timeRange, databaseID, invMask, clipArea):
|
|||
|
||||
# get the data and store it in a Numeric array.
|
||||
timeList, overlappingTimes = findOverlappingTimes(trList, timeRange)
|
||||
|
||||
# clipped size
|
||||
clipSize = (clipArea[1] - clipArea[0] + 1, clipArea[3] - clipArea[2] + 1)
|
||||
gridCount = len(overlappingTimes)
|
||||
|
||||
byteCube = numpy.empty(shape=(gridCount, clipSize[1], clipSize[0]), dtype=numpy.int8)
|
||||
|
||||
keyList = []
|
||||
wec = WECache(we, overlappingTimes, clipArea)
|
||||
for i,t in enumerate(overlappingTimes):
|
||||
wx = wec[t][0]
|
||||
byteCube[i] = wx[0]
|
||||
keyList.append(wx[1])
|
||||
(byteCube, histDict, keyList) = retrieveData(we, overlappingTimes, clipArea)
|
||||
gridCount = len(histDict)
|
||||
for i in xrange(len(overlappingTimes) -1, -1, -1):
|
||||
ot = overlappingTimes[i]
|
||||
if not ot in histDict:
|
||||
del overlappingTime[i]
|
||||
del timeList[i]
|
||||
|
||||
# make the variable name
|
||||
varName = we.getParmid().getParmName() + "_" + we.getParmid().getParmLevel()
|
||||
|
@ -1046,7 +1063,7 @@ def storeWeatherWE(we, trList, file, timeRange, databaseID, invMask, clipArea):
|
|||
setattr(var, "fillValue", fillValue)
|
||||
|
||||
## Extract the GridDataHistory info and save it
|
||||
storeGridDataHistory(file, we, wec, overlappingTimes)
|
||||
storeGridDataHistory(file, we, histDict)
|
||||
|
||||
logEvent("Saved", gridCount, varName, "grids")
|
||||
|
||||
|
@ -1061,19 +1078,13 @@ def storeDiscreteWE(we, trList, file, timeRange, databaseID, invMask, clipArea):
|
|||
# get the data and store it in a Numeric array.
|
||||
timeList, overlappingTimes = findOverlappingTimes(trList, timeRange)
|
||||
|
||||
# clipped size
|
||||
clipSize = (clipArea[1] - clipArea[0] + 1, clipArea[3] - clipArea[2] + 1)
|
||||
gridCount = len(overlappingTimes)
|
||||
|
||||
byteCube = numpy.empty(shape=(gridCount, clipSize[1], clipSize[0]), dtype=numpy.int8)
|
||||
|
||||
keyList = []
|
||||
wec = WECache(we, overlappingTimes, clipArea)
|
||||
for i,t in enumerate(overlappingTimes):
|
||||
dis = wec[t][0]
|
||||
byteCube[i] = dis[0]
|
||||
keyList.append(dis[1])
|
||||
|
||||
(byteCube, histDict, keyList) = retrieveData(we, overlappingTimes, clipArea)
|
||||
gridCount = len(histDict)
|
||||
for i in xrange(len(overlappingTimes) -1, -1, -1):
|
||||
ot = overlappingTimes[i]
|
||||
if not ot in histDict:
|
||||
del overlappingTime[i]
|
||||
del timeList[i]
|
||||
|
||||
# make the variable name
|
||||
varName = we.getParmid().getParmName() + "_" + we.getParmid().getParmLevel()
|
||||
|
@ -1135,7 +1146,7 @@ def storeDiscreteWE(we, trList, file, timeRange, databaseID, invMask, clipArea):
|
|||
setattr(var, "fillValue", fillValue)
|
||||
|
||||
## Extract the GridDataHistory info and save it
|
||||
storeGridDataHistory(file, we, wec, overlappingTimes)
|
||||
storeGridDataHistory(file, we, histDict)
|
||||
|
||||
logEvent("Saved", gridCount, varName, "grids")
|
||||
|
||||
|
@ -1325,7 +1336,7 @@ def main(outputFilename, parmList, databaseID, startTime,
|
|||
clipArea = extremaOfSetBits(maskGrid)
|
||||
maskGrid = clipToExtrema(maskGrid, clipArea)
|
||||
clippedGridSize = maskGrid.shape
|
||||
validPointCount = numpy.add.reduce(numpy.add.reduce(maskGrid))
|
||||
validPointCount = float(numpy.add.reduce(numpy.add.reduce(maskGrid)))
|
||||
|
||||
#invert the mask grid
|
||||
invMask = numpy.logical_not(maskGrid)
|
||||
|
|
|
@ -61,6 +61,7 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
|
|||
* Apr 14, 2008 1077 jkorman Initial implementation.
|
||||
* Nov 25, 2008 1684 chammack Camel Refactor
|
||||
* May 15, 2013 1869 bsteffen Remove DataURI from goes/poes soundings.
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -74,7 +75,7 @@ public class GOESSoundingDecoder extends AbstractDecoder implements
|
|||
public static final String PLUGIN_NAME = "goessounding";
|
||||
|
||||
/** The logger */
|
||||
private Log logger = LogFactory.getLog(getClass());
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private PointDataDescription pdd;
|
||||
|
||||
|
@ -131,7 +132,7 @@ public class GOESSoundingDecoder extends AbstractDecoder implements
|
|||
|
||||
PluginDataObject[] decodedData = null;
|
||||
|
||||
if (input != null && input.getDocumentData().length > 0) {
|
||||
if ((input != null) && (input.getDocumentData().length > 0)) {
|
||||
|
||||
WMOHeader wmoHeader = input.getWmoHeader();
|
||||
|
||||
|
@ -153,7 +154,6 @@ public class GOESSoundingDecoder extends AbstractDecoder implements
|
|||
container, this.pdd, dao);
|
||||
if (soundingData != null) {
|
||||
soundingData.setTraceId(traceId);
|
||||
soundingData.setPluginName(PLUGIN_NAME);
|
||||
PointDataView pdv = soundingData.getPointDataView();
|
||||
pdv.setString("wmoHeader",
|
||||
soundingData.getWmoHeader());
|
||||
|
|
|
@ -70,8 +70,6 @@ from com.raytheon.uf.common.parameter import Parameter;
|
|||
from com.raytheon.uf.common.parameter.mapping import ParameterMapper;
|
||||
|
||||
|
||||
PLUGIN_NAME = "grid"
|
||||
|
||||
# Static values for accessing parameter lookup tables
|
||||
PARAMETER_TABLE = "4.2"
|
||||
GENPROCESS_TABLE = "A"
|
||||
|
@ -131,7 +129,7 @@ THINNED_GRID_VALUES = THINNED_GRID_PT_MAP.values()
|
|||
# 04/7/09 #1994 bphillip Initial Creation.
|
||||
# Mar 25, 2013 1821 bsteffen Reshape grib data arrays in
|
||||
# place to improve performance.
|
||||
#
|
||||
# Sep 04, 2013 2298 rjpeter Removed setPluginName call
|
||||
class GribDecoder():
|
||||
|
||||
##
|
||||
|
@ -403,7 +401,6 @@ class GribDecoder():
|
|||
|
||||
# Construct the GribRecord
|
||||
record = GridRecord()
|
||||
record.setPluginName(PLUGIN_NAME)
|
||||
record.setDataTime(dataTime)
|
||||
record.setMessageData(numpyDataArray)
|
||||
record.setLocation(gdsSectionValues['coverage'])
|
||||
|
|
|
@ -92,8 +92,10 @@ import com.raytheon.uf.common.util.mapping.MultipleMappingException;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 3/11/10 4758 bphillip Initial Creation
|
||||
* Feb 15, 2013 1638 mschenke Moved array based utilities from Util into ArraysUtil
|
||||
* Mar 11, 2010 4758 bphillip Initial Creation
|
||||
* Feb 15, 2013 1638 mschenke Moved array based utilities from Util
|
||||
* into ArraysUtil
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -236,7 +238,7 @@ public class Grib1Decoder extends AbstractDecoder {
|
|||
.getGrib2Parameter(centerAlias, subcenterAlias, tableAlias,
|
||||
pdsVars.getParameterNumber());
|
||||
|
||||
if (parameter == null || parameter.getName().equals(MISSING)) {
|
||||
if ((parameter == null) || parameter.getName().equals(MISSING)) {
|
||||
try {
|
||||
logger.warn("Unable to map Grib 1 parameter to equivalent Grib 2 parameter for center ["
|
||||
+ centerid
|
||||
|
@ -294,7 +296,7 @@ public class Grib1Decoder extends AbstractDecoder {
|
|||
// unidata does not handle isEnsemble call when
|
||||
// octet size is less than 40.
|
||||
|
||||
if (pdsVars.getLength() > 40 && pdsVars.isEnsemble()) {
|
||||
if ((pdsVars.getLength() > 40) && pdsVars.isEnsemble()) {
|
||||
// rcg: added code to get perturbation
|
||||
int pos42 = pdsVars.getOctet(42);
|
||||
int pos43 = pdsVars.getOctet(43);
|
||||
|
@ -363,13 +365,13 @@ public class Grib1Decoder extends AbstractDecoder {
|
|||
int timeRange = pdsVars.getTimeRangeIndicator();
|
||||
|
||||
// Check for initialization of average or accumulation parameters
|
||||
if ((AVG_ACCUM_LIST.contains(timeRange) && dataTime
|
||||
.getValidPeriod().getDuration() == 0)) {
|
||||
if ((AVG_ACCUM_LIST.contains(timeRange) && (dataTime
|
||||
.getValidPeriod().getDuration() == 0))) {
|
||||
statusHandler.handle(Priority.EVENTA,
|
||||
"Discarding empty accumulation grid");
|
||||
return null;
|
||||
} else if ((gdsVars != null && gdsVars.isThin())
|
||||
|| (gdsVars == null && (gridCoverage instanceof LatLonGridCoverage && ((LatLonGridCoverage) gridCoverage)
|
||||
} else if (((gdsVars != null) && gdsVars.isThin())
|
||||
|| ((gdsVars == null) && ((gridCoverage instanceof LatLonGridCoverage) && ((LatLonGridCoverage) gridCoverage)
|
||||
.isThin()))) {
|
||||
// Unfortunately the UCAR Decoder does Cubic Spline
|
||||
// interpolation, however we want to do simpler linear
|
||||
|
@ -468,7 +470,7 @@ public class Grib1Decoder extends AbstractDecoder {
|
|||
|
||||
if (newAbbr == null) {
|
||||
if (!parameterName.equals(MISSING)
|
||||
&& dataTime.getValidPeriod().getDuration() > 0) {
|
||||
&& (dataTime.getValidPeriod().getDuration() > 0)) {
|
||||
parameterAbbreviation = parameterAbbreviation
|
||||
+ String.valueOf(dataTime.getValidPeriod()
|
||||
.getDuration() / 3600000) + "hr";
|
||||
|
@ -485,7 +487,6 @@ public class Grib1Decoder extends AbstractDecoder {
|
|||
parameterAbbreviation = e.getArbitraryMapping();
|
||||
}
|
||||
|
||||
retVal.setPluginName("grid");
|
||||
Parameter param = new Parameter(parameterAbbreviation, parameterName,
|
||||
parameterUnit);
|
||||
GribParamTranslator.getInstance().getParameterNameAlias(modelName,
|
||||
|
@ -530,7 +531,7 @@ public class Grib1Decoder extends AbstractDecoder {
|
|||
|
||||
for (int row = 0; row < rowCount; row++) {
|
||||
for (int column = 0; column < columnCount; column++) {
|
||||
newGrid[row][column] = data[row * columnCount + column];
|
||||
newGrid[row][column] = data[(row * columnCount) + column];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -569,8 +570,8 @@ public class Grib1Decoder extends AbstractDecoder {
|
|||
total -= 1;
|
||||
trail = inData[inIndex++];
|
||||
}
|
||||
outData[outIndex++] = inData[inIndex] * total + trail
|
||||
* (1 - total);
|
||||
outData[outIndex++] = (inData[inIndex] * total)
|
||||
+ (trail * (1 - total));
|
||||
total += dx;
|
||||
}
|
||||
outData[outIndex++] = inData[inIndex++];
|
||||
|
@ -594,7 +595,7 @@ public class Grib1Decoder extends AbstractDecoder {
|
|||
|
||||
for (int row = 0; row < rowCount; row++) {
|
||||
for (int column = 0; column < columnCount; column++) {
|
||||
newGrid[row * columnCount + column] = data[row][column];
|
||||
newGrid[(row * columnCount) + column] = data[row][column];
|
||||
}
|
||||
}
|
||||
return newGrid;
|
||||
|
@ -663,7 +664,7 @@ public class Grib1Decoder extends AbstractDecoder {
|
|||
private void correctForScanMode(float[] data, int nx, int ny,
|
||||
boolean bmsExists, int scanMode) {
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
if (bmsExists && data[i] == -9999) {
|
||||
if (bmsExists && (data[i] == -9999)) {
|
||||
data[i] = -999999;
|
||||
}
|
||||
}
|
||||
|
@ -884,7 +885,7 @@ public class Grib1Decoder extends AbstractDecoder {
|
|||
|
||||
GridCoverage grid = GribSpatialCache.getInstance().getGrid(coverage);
|
||||
|
||||
if (grid == null && gridNumber != 255) {
|
||||
if ((grid == null) && (gridNumber != 255)) {
|
||||
// 255 is specifically reserved to non-defined grids and should not
|
||||
// use the gridNumber as a lookup value
|
||||
|
||||
|
@ -929,7 +930,7 @@ public class Grib1Decoder extends AbstractDecoder {
|
|||
int subcenterId, int process, GridCoverage grid) {
|
||||
GridModel gridModel = GribModelLookup.getInstance().getModel(centerId,
|
||||
subcenterId, grid, process);
|
||||
if (gridModel != null && gridModel.getAnalysisOnly()) {
|
||||
if ((gridModel != null) && gridModel.getAnalysisOnly()) {
|
||||
time.getUtilityFlags().remove(FLAG.FCST_USED);
|
||||
}
|
||||
}
|
||||
|
@ -1175,7 +1176,7 @@ public class Grib1Decoder extends AbstractDecoder {
|
|||
level1Value = lval1;
|
||||
break;
|
||||
default:
|
||||
if (ltype1 > 99 && ltype1 < 200) {
|
||||
if ((ltype1 > 99) && (ltype1 < 200)) {
|
||||
level1Type = 255;
|
||||
logger.warn("GRIB1 level " + ltype1 + " not recognized");
|
||||
}
|
||||
|
@ -1234,7 +1235,7 @@ public class Grib1Decoder extends AbstractDecoder {
|
|||
}
|
||||
|
||||
// Scale the level one value if necessary
|
||||
if (scaleFactor1 == 0 || value1 == 0) {
|
||||
if ((scaleFactor1 == 0) || (value1 == 0)) {
|
||||
levelOneValue = value1;
|
||||
} else {
|
||||
levelOneValue = new Double((float) (value1 * Math.pow(10,
|
||||
|
@ -1249,13 +1250,13 @@ public class Grib1Decoder extends AbstractDecoder {
|
|||
} else if (levelTwoNumber == 1) {
|
||||
levelTwoValue = Level.getInvalidLevelValue();
|
||||
} else {
|
||||
if (scaleFactor2 == 0 || value2 == 0) {
|
||||
if ((scaleFactor2 == 0) || (value2 == 0)) {
|
||||
levelTwoValue = value2;
|
||||
} else {
|
||||
levelTwoValue = (value2 * Math.pow(10, scaleFactor2 * -1));
|
||||
}
|
||||
}
|
||||
if (levelName.equals("SFC") && levelOneValue != 0) {
|
||||
if (levelName.equals("SFC") && (levelOneValue != 0)) {
|
||||
levelOneValue = 0.0;
|
||||
}
|
||||
if (levelName.equals("EATM")) {
|
||||
|
@ -1289,7 +1290,7 @@ public class Grib1Decoder extends AbstractDecoder {
|
|||
}
|
||||
|
||||
if (lon >= 180) {
|
||||
lon = (180 - lon % 180) * -1;
|
||||
lon = (180 - (lon % 180)) * -1;
|
||||
} else if (lon < -180) {
|
||||
lon = (180 - (-lon % 180));
|
||||
}
|
||||
|
@ -1313,7 +1314,7 @@ public class Grib1Decoder extends AbstractDecoder {
|
|||
}
|
||||
|
||||
if (lat > 90) {
|
||||
lat = 90 - lat % 90;
|
||||
lat = 90 - (lat % 90);
|
||||
} else if (lat < -90) {
|
||||
lat = (90 - (-lat % 90)) * -1;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,8 @@ import com.raytheon.uf.edex.database.DataAccessLayerException;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 4, 2012 bsteffen Initial creation
|
||||
* May 04, 2012 bsteffen Initial creation
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -62,10 +63,9 @@ public class GridToGribConverter {
|
|||
GridRecord grid = records[i];
|
||||
GribRecord grib = new GribRecord();
|
||||
GribModel model = new GribModel();
|
||||
grib.setPluginName("grib");
|
||||
grib.setDataTime(grid.getDataTime());
|
||||
model.setModelName(grid.getDatasetId());
|
||||
if (grid.getSecondaryId() != null
|
||||
if ((grid.getSecondaryId() != null)
|
||||
&& grid.getSecondaryId().startsWith("Version")) {
|
||||
grib.setGridVersion(Integer.parseInt(grid.getSecondaryId()
|
||||
.replace("Version", "")));
|
||||
|
@ -108,31 +108,31 @@ public class GridToGribConverter {
|
|||
model.setTypeEnsemble(3);
|
||||
}
|
||||
Object centerid = grid.getExtraAttribute("centerid");
|
||||
if (centerid != null && centerid instanceof Integer) {
|
||||
if ((centerid != null) && (centerid instanceof Integer)) {
|
||||
model.setCenterid((Integer) centerid);
|
||||
}
|
||||
Object subcenterid = grid.getExtraAttribute("subcenterid");
|
||||
if (subcenterid != null && subcenterid instanceof Integer) {
|
||||
if ((subcenterid != null) && (subcenterid instanceof Integer)) {
|
||||
model.setSubcenterid((Integer) subcenterid);
|
||||
}
|
||||
Object genprocess = grid.getExtraAttribute("genprocess");
|
||||
if (genprocess != null && genprocess instanceof Integer) {
|
||||
if ((genprocess != null) && (genprocess instanceof Integer)) {
|
||||
model.setGenprocess((Integer) genprocess);
|
||||
}
|
||||
Object backGenprocess = grid.getExtraAttribute("backGenprocess");
|
||||
if (backGenprocess != null && backGenprocess instanceof Integer) {
|
||||
if ((backGenprocess != null) && (backGenprocess instanceof Integer)) {
|
||||
model.setBackGenprocess((Integer) backGenprocess);
|
||||
}
|
||||
Object pdsTemplate = grid.getExtraAttribute("pdsTemplate");
|
||||
if (pdsTemplate != null && pdsTemplate instanceof Integer) {
|
||||
if ((pdsTemplate != null) && (pdsTemplate instanceof Integer)) {
|
||||
model.setPdsTemplate((Integer) pdsTemplate);
|
||||
}
|
||||
Object gridid = grid.getExtraAttribute("gridid");
|
||||
if (gridid != null && gridid instanceof String) {
|
||||
if ((gridid != null) && (gridid instanceof String)) {
|
||||
model.setGridid((String) gridid);
|
||||
}
|
||||
Object numForecasts = grid.getExtraAttribute("numForecasts");
|
||||
if (numForecasts != null && numForecasts instanceof Integer) {
|
||||
if ((numForecasts != null) && (numForecasts instanceof Integer)) {
|
||||
model.setNumForecasts((Integer) numForecasts);
|
||||
}
|
||||
model.setLevel(grid.getLevel());
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.util.Calendar;
|
|||
|
||||
import com.raytheon.edex.plugin.grib.exception.GribException;
|
||||
import com.raytheon.uf.common.dataplugin.PluginException;
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridConstants;
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
|
@ -51,7 +50,8 @@ import com.raytheon.uf.common.time.DataTime;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 03/09/11 4243 porricel Initial Creation
|
||||
* Mar 09, 2011 4243 porricel Initial Creation
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -84,7 +84,6 @@ public class CPCoutlookGribPostProcessor implements IDecoderPostProcessor {
|
|||
record.setDataURI(null);
|
||||
|
||||
try {
|
||||
record.setPluginName(GridConstants.GRID);
|
||||
record.constructDataURI();
|
||||
} catch (PluginException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
|
|
|
@ -69,10 +69,11 @@ import com.raytheon.uf.edex.plugin.grid.dao.GridDao;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 4/09/10 4638 bphillip Initial Creation
|
||||
* Apr 09, 2010 4638 bphillip Initial Creation
|
||||
* Mar 14, 2013 1794 djohnson FileUtil.listFiles now returns List.
|
||||
* Mar 27, 2013 1821 bsteffen Reduce db and pypies requests in grid
|
||||
* assembler.
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -231,7 +232,6 @@ public class EnsembleGridAssembler implements IDecoderPostProcessor {
|
|||
newRecord.setEnsembleId(record.getEnsembleId());
|
||||
newRecord.setDataTime(record.getDataTime());
|
||||
newRecord.setDataURI(null);
|
||||
newRecord.setPluginName(GridConstants.GRID);
|
||||
newRecord.setInsertTime(Calendar.getInstance());
|
||||
try {
|
||||
newRecord.constructDataURI();
|
||||
|
@ -319,7 +319,7 @@ public class EnsembleGridAssembler implements IDecoderPostProcessor {
|
|||
} else {
|
||||
Util.insertSubgrid(assembledData, Util.resizeDataTo2D(
|
||||
(float[]) record.getMessageData(), coverage.getNx(),
|
||||
coverage.getNy()), nx * modIndex - modIndex, 0, nx, ny);
|
||||
coverage.getNy()), (nx * modIndex) - modIndex, 0, nx, ny);
|
||||
}
|
||||
|
||||
assembledRecord.setMessageData(Util.resizeDataTo1D(assembledData,
|
||||
|
|
|
@ -53,6 +53,7 @@ import com.raytheon.uf.edex.plugin.grid.dao.GridDao;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 25, 2011 rgeorge Initial creation
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -69,7 +70,7 @@ public class GFSProcessor extends SixHrPrecipGridProcessor {
|
|||
public GridRecord[] process(GridRecord record) throws GribException {
|
||||
// Post process the data if this is a Total Precipitation grid
|
||||
if (record.getParameter().getAbbreviation().equals("TP12hr")
|
||||
&& record.getDataTime().getFcstTime() / 3600 > 180) {
|
||||
&& ((record.getDataTime().getFcstTime() / 3600) > 180)) {
|
||||
return super.process(record);
|
||||
}
|
||||
return new GridRecord[] { record };
|
||||
|
@ -86,6 +87,7 @@ public class GFSProcessor extends SixHrPrecipGridProcessor {
|
|||
* @return The generated 6-hr precipitation grids
|
||||
* @throws GribException
|
||||
*/
|
||||
@Override
|
||||
protected synchronized GridRecord[] generate6hrPrecipGrids(GridRecord record)
|
||||
throws GribException {
|
||||
List<GridRecord> generated6hrPrecips = new ArrayList<GridRecord>();
|
||||
|
@ -111,11 +113,11 @@ public class GFSProcessor extends SixHrPrecipGridProcessor {
|
|||
|
||||
Collections.sort(precipInventory, comparator);
|
||||
// loop through set, find twelve hour gaps and create new 6hr records.
|
||||
for (int i = 0; i < precipInventory.size() - 1; i++) {
|
||||
for (int i = 0; i < (precipInventory.size() - 1); i++) {
|
||||
GridRecord sequence1Record = precipInventory.get(i);
|
||||
GridRecord sequence2Record = precipInventory.get(i + 1);
|
||||
if (sequence1Record.getDataTime().getFcstTime() == sequence2Record
|
||||
.getDataTime().getFcstTime() - SECONDS_IN_12_HRS) {
|
||||
if (sequence1Record.getDataTime().getFcstTime() == (sequence2Record
|
||||
.getDataTime().getFcstTime() - SECONDS_IN_12_HRS)) {
|
||||
// we have a 12Hr gap
|
||||
generated6hrPrecips.add(calculate6hrPrecip(sequence1Record,
|
||||
sequence2Record));
|
||||
|
@ -226,7 +228,6 @@ public class GFSProcessor extends SixHrPrecipGridProcessor {
|
|||
record.setDataTime(newDataTime);
|
||||
record.setDataURI(null);
|
||||
try {
|
||||
record.setPluginName(GridConstants.GRID);
|
||||
record.constructDataURI();
|
||||
} catch (PluginException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
|
|
|
@ -47,7 +47,8 @@ import com.raytheon.uf.edex.plugin.grid.dao.GridDao;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 17, 2011 bphillip Initial creation
|
||||
* Nov 17, 2011 bphillip Initial creation
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -169,14 +170,14 @@ public class Nam80PostProcessor implements IDecoderPostProcessor {
|
|||
float[] newData = null;
|
||||
float[] tp6Data = null;
|
||||
if (tp12HrRecord.getMessageData() == null) {
|
||||
newData = (float[]) ((FloatDataRecord) dao.getHDF5Data(
|
||||
tp12HrRecord, -1)[0]).getFloatData();
|
||||
newData = ((FloatDataRecord) dao.getHDF5Data(tp12HrRecord, -1)[0])
|
||||
.getFloatData();
|
||||
} else {
|
||||
newData = (float[]) tp12HrRecord.getMessageData();
|
||||
}
|
||||
if (tp6HrRecord.getMessageData() == null) {
|
||||
tp6Data = (float[]) ((FloatDataRecord) dao.getHDF5Data(
|
||||
tp6HrRecord, -1)[0]).getFloatData();
|
||||
tp6Data = ((FloatDataRecord) dao.getHDF5Data(tp6HrRecord, -1)[0])
|
||||
.getFloatData();
|
||||
} else {
|
||||
tp6Data = (float[]) tp6HrRecord.getMessageData();
|
||||
}
|
||||
|
@ -197,7 +198,7 @@ public class Nam80PostProcessor implements IDecoderPostProcessor {
|
|||
Calendar refTime = tp12HrRecord.getDataTime().getRefTimeAsCalendar();
|
||||
Date start = new Date(tp12HrRecord.getDataTime().getValidPeriod()
|
||||
.getEnd().getTime()
|
||||
- SECONDS_IN_6_HRS * 1000);
|
||||
- (SECONDS_IN_6_HRS * 1000));
|
||||
|
||||
DataTime newDataTime = new DataTime(refTime, tp12HrRecord.getDataTime()
|
||||
.getFcstTime(), new TimeRange(start, tp12HrRecord.getDataTime()
|
||||
|
@ -208,7 +209,6 @@ public class Nam80PostProcessor implements IDecoderPostProcessor {
|
|||
newRecord.getInfo().setId(null);
|
||||
newRecord.setDataURI(null);
|
||||
try {
|
||||
newRecord.setPluginName(GridConstants.GRID);
|
||||
newRecord.constructDataURI();
|
||||
} catch (PluginException e) {
|
||||
throw new GribException("Error constructing dataURI!", e);
|
||||
|
|
|
@ -26,7 +26,6 @@ import java.util.List;
|
|||
|
||||
import com.raytheon.edex.plugin.grib.exception.GribException;
|
||||
import com.raytheon.uf.common.dataplugin.PluginException;
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridConstants;
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
|
||||
import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
|
||||
import com.raytheon.uf.common.parameter.Parameter;
|
||||
|
@ -48,6 +47,7 @@ import com.raytheon.uf.edex.plugin.grid.dao.GridDao;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 25, 2011 rgeorge Initial creation
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -107,8 +107,7 @@ public abstract class SixHrPrecipGridProcessor implements IDecoderPostProcessor
|
|||
// previous grid
|
||||
else {
|
||||
for (GridRecord rec : precipInventory) {
|
||||
if (rec.getDataTime().getFcstTime() == currentFcstTime
|
||||
- SECONDS_IN_6_HRS) {
|
||||
if (rec.getDataTime().getFcstTime() == (currentFcstTime - SECONDS_IN_6_HRS)) {
|
||||
tp6hrRecords.add(calculate6hrPrecip(rec, record));
|
||||
}
|
||||
}
|
||||
|
@ -218,7 +217,6 @@ public abstract class SixHrPrecipGridProcessor implements IDecoderPostProcessor
|
|||
record.setDataTime(newDataTime);
|
||||
record.setDataURI(null);
|
||||
try {
|
||||
record.setPluginName(GridConstants.GRID);
|
||||
record.constructDataURI();
|
||||
} catch (PluginException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
|
|
|
@ -26,7 +26,6 @@ import java.util.List;
|
|||
|
||||
import com.raytheon.edex.plugin.grib.exception.GribException;
|
||||
import com.raytheon.uf.common.dataplugin.PluginException;
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridConstants;
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
|
||||
import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
|
||||
import com.raytheon.uf.common.parameter.Parameter;
|
||||
|
@ -47,7 +46,8 @@ import com.raytheon.uf.edex.plugin.grid.dao.GridDao;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 24, 2012 DR 14299 M. Porricelli Initial creation
|
||||
* Jan 24, 2012 14299 M. Porricelli Initial creation
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -108,8 +108,7 @@ public abstract class ThreeHrPrecipGridProcessor implements
|
|||
// previous grid
|
||||
else {
|
||||
for (GridRecord rec : precipInventory) {
|
||||
if (rec.getDataTime().getFcstTime() == currentFcstTime
|
||||
- SECONDS_IN_3_HRS) {
|
||||
if (rec.getDataTime().getFcstTime() == (currentFcstTime - SECONDS_IN_3_HRS)) {
|
||||
tp3hrRecords.add(calculate3hrPrecip(rec, record));
|
||||
}
|
||||
}
|
||||
|
@ -220,7 +219,6 @@ public abstract class ThreeHrPrecipGridProcessor implements
|
|||
record.setDataTime(newDataTime);
|
||||
record.setDataURI(null);
|
||||
try {
|
||||
record.setPluginName(GridConstants.GRID);
|
||||
record.constructDataURI();
|
||||
} catch (PluginException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
|
||||
<bean id="hydroPluginName" class="java.lang.String">
|
||||
<constructor-arg type="java.lang.String" value="ldadhydro" />
|
||||
</bean>
|
||||
<bean id="hydroProperties" class="com.raytheon.uf.common.dataplugin.PluginProperties">
|
||||
<property name="pluginName" value="ldadhydro" />
|
||||
<property name="pluginFQN" value="com.raytheon.uf.common.dataplugin.ldadhydro" />
|
||||
|
@ -12,12 +9,8 @@
|
|||
<property name="record" value="com.raytheon.uf.common.dataplugin.ldadhydro.HydroLdadRecord" />
|
||||
</bean>
|
||||
|
||||
<bean id="hydroDecoder" class="com.raytheon.edex.plugin.ldadhydro.dao.HydroDecoder">
|
||||
<constructor-arg ref="hydroPluginName" />
|
||||
</bean>
|
||||
<bean factory-bean="pluginRegistry" factory-method="register">
|
||||
<constructor-arg ref="hydroPluginName" />
|
||||
<constructor-arg value="ldadhydro" />
|
||||
<constructor-arg ref="hydroProperties" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
|
||||
|
||||
<bean id="hydroDecoder" class="com.raytheon.edex.plugin.ldadhydro.dao.HydroDecoder">
|
||||
<constructor-arg ref="hydroPluginName" />
|
||||
</bean>
|
||||
<bean id="hydroDecoder" class="com.raytheon.edex.plugin.ldadhydro.dao.HydroDecoder"/>
|
||||
|
||||
<bean id="hydroDatabase" class="java.lang.String">
|
||||
<constructor-arg type="java.lang.String" value="metadata" />
|
||||
|
|
|
@ -64,9 +64,10 @@ import com.raytheon.uf.common.time.DataTime;
|
|||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* ate Ticket# Engineer Description
|
||||
* ----------- ---------- ----------- --------------------------
|
||||
* 9/30/09 vkorolev Initial creation
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 30, 2009 vkorolev Initial creation
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
* 10/16/13 DR 16685 M.Porricelli Add error checking for date
|
||||
* format
|
||||
* </pre>
|
||||
|
@ -79,8 +80,6 @@ public class HydroDecoder<E> extends AbstractDecoder implements IBinaryDecoder {
|
|||
|
||||
private static final String BAD_PROPERTY_FMT = "NumberFormatException setting property %s.%s(%s %s)";
|
||||
|
||||
private final String PLUGIN_NAME;
|
||||
|
||||
private String traceId = null;
|
||||
|
||||
public SimpleDateFormat sdf = new SimpleDateFormat("yy/MM/dd HH:mm:ss");
|
||||
|
@ -89,10 +88,6 @@ public class HydroDecoder<E> extends AbstractDecoder implements IBinaryDecoder {
|
|||
|
||||
public Properties configFile = new Properties();
|
||||
|
||||
public HydroDecoder(String pluginName) throws DecoderException {
|
||||
PLUGIN_NAME = pluginName;
|
||||
}
|
||||
|
||||
public void setTraceId(String id) {
|
||||
traceId = id;
|
||||
}
|
||||
|
@ -156,7 +151,6 @@ public class HydroDecoder<E> extends AbstractDecoder implements IBinaryDecoder {
|
|||
HydroLdadRecord record = new HydroLdadRecord();
|
||||
SurfaceObsLocation location = new SurfaceObsLocation();
|
||||
record.setDataProvider(dd.provider);
|
||||
record.setPluginName(PLUGIN_NAME);
|
||||
record.setStationType(dd.type);
|
||||
record.setReportTime(dd.reportTime);
|
||||
// Loop through fields
|
||||
|
@ -332,8 +326,7 @@ public class HydroDecoder<E> extends AbstractDecoder implements IBinaryDecoder {
|
|||
Class cls = record.getClass();
|
||||
|
||||
Field fieldlist[] = cls.getDeclaredFields();
|
||||
for (int i = 0; i < fieldlist.length; i++) {
|
||||
Field fld = fieldlist[i];
|
||||
for (Field fld : fieldlist) {
|
||||
System.out.println("name = " + fld.getName());
|
||||
// System.out.println("decl class = " +
|
||||
// fld.getDeclaringClass());
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
|
||||
<bean id="manualPluginName" class="java.lang.String">
|
||||
<constructor-arg type="java.lang.String" value="ldadmanual" />
|
||||
</bean>
|
||||
<bean id="manualProperties" class="com.raytheon.uf.common.dataplugin.PluginProperties">
|
||||
<property name="pluginName" value="ldadmanual" />
|
||||
<property name="pluginFQN" value="com.raytheon.edex.plugin.ldadmanual" />
|
||||
|
@ -12,9 +9,6 @@
|
|||
<property name="record" value="com.raytheon.edex.plugin.ldadmanual.dao.ManualLdadRecord" />
|
||||
</bean>
|
||||
|
||||
<bean id="manualDecoder" class="com.raytheon.edex.plugin.ldadmanual.dao.ManualDecoder">
|
||||
<constructor-arg ref="manualPluginName" />
|
||||
</bean>
|
||||
<bean factory-bean="pluginRegistry" factory-method="register">
|
||||
<constructor-arg value="ldadmanual" />
|
||||
<constructor-arg ref="manualProperties" />
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
|
||||
|
||||
<bean id="manualDecoder" class="com.raytheon.edex.plugin.ldadmanual.dao.ManualDecoder">
|
||||
<constructor-arg ref="manualPluginName" />
|
||||
</bean>
|
||||
<bean id="manualDecoder" class="com.raytheon.edex.plugin.ldadmanual.dao.ManualDecoder"/>
|
||||
<bean id="manualDatabase" class="java.lang.String">
|
||||
<constructor-arg type="java.lang.String" value="metadata" />
|
||||
</bean>
|
||||
|
|
|
@ -27,7 +27,6 @@ import java.io.StringReader;
|
|||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
|
@ -63,9 +62,10 @@ import com.raytheon.uf.common.time.DataTime;
|
|||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* ate Ticket# Engineer Description
|
||||
* ----------- ---------- ----------- --------------------------
|
||||
* 9/30/09 vkorolev Initial creation
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 30, 2009 vkorolev Initial creation
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
* </pre>
|
||||
*
|
||||
* @author vkorolev
|
||||
|
@ -73,9 +73,6 @@ import com.raytheon.uf.common.time.DataTime;
|
|||
*/
|
||||
|
||||
public class ManualDecoder<E> extends AbstractDecoder implements IBinaryDecoder {
|
||||
|
||||
private final String PLUGIN_NAME;
|
||||
|
||||
private String traceId = null;
|
||||
|
||||
public SimpleDateFormat sdf = new SimpleDateFormat("yy/MM/dd HH:mm:ss");
|
||||
|
@ -84,10 +81,6 @@ public class ManualDecoder<E> extends AbstractDecoder implements IBinaryDecoder
|
|||
|
||||
public Properties configFile = new Properties();
|
||||
|
||||
public ManualDecoder(String pluginName) throws DecoderException {
|
||||
PLUGIN_NAME = pluginName;
|
||||
}
|
||||
|
||||
public void setTraceId(String id) {
|
||||
traceId = id;
|
||||
}
|
||||
|
@ -151,7 +144,6 @@ public class ManualDecoder<E> extends AbstractDecoder implements IBinaryDecoder
|
|||
ManualLdadRecord record = new ManualLdadRecord();
|
||||
SurfaceObsLocation location = new SurfaceObsLocation();
|
||||
record.setProviderId(dd.provider);
|
||||
record.setPluginName(PLUGIN_NAME);
|
||||
// record.setReportType???(dd.type));
|
||||
// record.set???(dd.reportTime);
|
||||
// Loop through fields
|
||||
|
@ -241,14 +233,13 @@ public class ManualDecoder<E> extends AbstractDecoder implements IBinaryDecoder
|
|||
* @throws ClassNotFoundException
|
||||
* @throws Throwable
|
||||
*/
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setProperty(String name, Object obj, String value, String vunit) {
|
||||
|
||||
String prop = Character.toUpperCase(name.charAt(0)) + name.substring(1);
|
||||
String mname = "set" + prop;
|
||||
Object val = null;
|
||||
try {
|
||||
@SuppressWarnings("rawtypes")
|
||||
Class cls = obj.getClass();
|
||||
Field fld = cls.getDeclaredField(name);
|
||||
Class<?> clazz = fld.getType();
|
||||
|
@ -301,27 +292,4 @@ public class ManualDecoder<E> extends AbstractDecoder implements IBinaryDecoder
|
|||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// List of Fields in record
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void main(String args[]) {
|
||||
ManualLdadRecord record = new ManualLdadRecord();
|
||||
try {
|
||||
Class cls = record.getClass();
|
||||
|
||||
Field fieldlist[] = cls.getDeclaredFields();
|
||||
for (int i = 0; i < fieldlist.length; i++) {
|
||||
Field fld = fieldlist[i];
|
||||
System.out.println("name = " + fld.getName());
|
||||
// System.out.println("decl class = " +
|
||||
// fld.getDeclaringClass());
|
||||
System.out.println("type = " + fld.getType());
|
||||
int mod = fld.getModifiers();
|
||||
System.out.println("modifiers = " + Modifier.toString(mod));
|
||||
System.out.println("-----");
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
System.err.println(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -68,11 +68,13 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ----------- ---------- ----------- --------------------------
|
||||
* 10/07/09 vkorolev Initial creation
|
||||
* Apr 4, 2013 1846 bkowal Added an index on refTime and forecastTime
|
||||
* Apr 12, 2013 1857 bgonzale Added SequenceGenerator annotation.
|
||||
* Oct 07, 2009 vkorolev Initial creation
|
||||
* Apr 04, 2013 1846 bkowal Added an index on refTime and
|
||||
* forecastTime
|
||||
* Apr 12, 2013 1857 bgonzale Added SequenceGenerator annotation.
|
||||
* May 07, 2013 1869 bsteffen Remove dataURI column from
|
||||
* PluginDataObject.
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -87,309 +89,305 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
* Both refTime and forecastTime are included in the refTimeIndex since
|
||||
* forecastTime is unlikely to be used.
|
||||
*/
|
||||
@org.hibernate.annotations.Table(
|
||||
appliesTo = "ldadprofiler",
|
||||
indexes = {
|
||||
@Index(name = "ldadprofiler_refTimeIndex", columnNames = { "refTime", "forecastTime" } )
|
||||
}
|
||||
)
|
||||
@org.hibernate.annotations.Table(appliesTo = "ldadprofiler", indexes = { @Index(name = "ldadprofiler_refTimeIndex", columnNames = {
|
||||
"refTime", "forecastTime" }) })
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@DynamicSerialize
|
||||
public class ProfilerLdadObs extends PersistablePluginDataObject implements
|
||||
ISpatialEnabled, IDecoderGettable, IPointData, IPersistable {
|
||||
ISpatialEnabled, IDecoderGettable, IPointData, IPersistable {
|
||||
|
||||
public static final String PLUGIN_NAME = "ldadprofiler";
|
||||
public static final String PLUGIN_NAME = "ldadprofiler";
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static final Unit<Angle> LOCATION_UNIT = NonSI.DEGREE_ANGLE;
|
||||
public static final Unit<Angle> LOCATION_UNIT = NonSI.DEGREE_ANGLE;
|
||||
|
||||
public static final Unit<Velocity> WIND_SPEED_UNIT = SI.METERS_PER_SECOND;
|
||||
public static final Unit<Velocity> WIND_SPEED_UNIT = SI.METERS_PER_SECOND;
|
||||
|
||||
public static final Unit<Angle> WIND_DIR_UNIT = NonSI.DEGREE_ANGLE;
|
||||
public static final Unit<Angle> WIND_DIR_UNIT = NonSI.DEGREE_ANGLE;
|
||||
|
||||
private static final HashMap<String, String> PARM_MAP = new HashMap<String, String>();
|
||||
private static final HashMap<String, String> PARM_MAP = new HashMap<String, String>();
|
||||
|
||||
static {
|
||||
PARM_MAP.put("NLAT", STA_LAT);
|
||||
PARM_MAP.put("NLON", STA_LON);
|
||||
PARM_MAP.put("WS", SFC_WNDSPD);
|
||||
PARM_MAP.put("WD", SFC_WNDDIR);
|
||||
}
|
||||
static {
|
||||
PARM_MAP.put("NLAT", STA_LAT);
|
||||
PARM_MAP.put("NLON", STA_LON);
|
||||
PARM_MAP.put("WS", SFC_WNDSPD);
|
||||
PARM_MAP.put("WD", SFC_WNDDIR);
|
||||
}
|
||||
|
||||
private static final String PRESS = "PRESS";
|
||||
private static final String PRESS = "PRESS";
|
||||
|
||||
private static final String AGL = "AGL";
|
||||
private static final String AGL = "AGL";
|
||||
|
||||
public static final String PRESS_PARAM_PTRN = ".*:" + PRESS + "=\\d{2,4}";
|
||||
public static final String PRESS_PARAM_PTRN = ".*:" + PRESS + "=\\d{2,4}";
|
||||
|
||||
public static final String AGL_PARAM_PTRN = ".*:" + AGL + "=\\d{2,4}";
|
||||
public static final String AGL_PARAM_PTRN = ".*:" + AGL + "=\\d{2,4}";
|
||||
|
||||
@Transient
|
||||
private String parameterName = null;
|
||||
@Transient
|
||||
private String parameterName = null;
|
||||
|
||||
@DataURI(position = 1)
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private Integer reportType;
|
||||
@DataURI(position = 1)
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private Integer reportType;
|
||||
|
||||
// Location
|
||||
@Embedded
|
||||
@DataURI(position = 2, embedded = true)
|
||||
@XmlElement
|
||||
@DynamicSerializeElement
|
||||
private SurfaceObsLocation location; // latitude, longitude, elevation,
|
||||
// Location
|
||||
@Embedded
|
||||
@DataURI(position = 2, embedded = true)
|
||||
@XmlElement
|
||||
@DynamicSerializeElement
|
||||
private SurfaceObsLocation location; // latitude, longitude, elevation,
|
||||
|
||||
// stationId
|
||||
// stationId
|
||||
|
||||
// Base time in Epoch "seconds since 1970-01-01 00:00:00 UTC"
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
@XmlElement
|
||||
int base_time;
|
||||
// Base time in Epoch "seconds since 1970-01-01 00:00:00 UTC"
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
@XmlElement
|
||||
int base_time;
|
||||
|
||||
// Consensus start time offset from base_time
|
||||
// "seconds since 2009/10/07 00:00:00 UTC"
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
@XmlElement
|
||||
double start_time_offset;
|
||||
// Consensus start time offset from base_time
|
||||
// "seconds since 2009/10/07 00:00:00 UTC"
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
@XmlElement
|
||||
double start_time_offset;
|
||||
|
||||
// Consensus end time offset from base_time
|
||||
// "seconds since 2009/10/07 00:00:00 UTC"
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
@XmlElement
|
||||
double end_time_offset;
|
||||
// Consensus end time offset from base_time
|
||||
// "seconds since 2009/10/07 00:00:00 UTC"
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
@XmlElement
|
||||
double end_time_offset;
|
||||
|
||||
// nhts Number of heights?
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
@XmlElement
|
||||
int nhts;
|
||||
// nhts Number of heights?
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
@XmlElement
|
||||
int nhts;
|
||||
|
||||
// the level data
|
||||
@XmlElement
|
||||
@DynamicSerializeElement
|
||||
@Transient
|
||||
private List<ProfilerLdadLevel> levels;
|
||||
// the level data
|
||||
@XmlElement
|
||||
@DynamicSerializeElement
|
||||
@Transient
|
||||
private List<ProfilerLdadLevel> levels;
|
||||
|
||||
// The profiler observation time.
|
||||
@Column
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private Calendar timeObs;
|
||||
// The profiler observation time.
|
||||
@Column
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private Calendar timeObs;
|
||||
|
||||
@Column
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private String stationName;
|
||||
@Column
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private String stationName;
|
||||
|
||||
@Embedded
|
||||
@DynamicSerializeElement
|
||||
private PointDataView pointDataView;
|
||||
@Embedded
|
||||
@DynamicSerializeElement
|
||||
private PointDataView pointDataView;
|
||||
|
||||
/**
|
||||
* @return the base_time
|
||||
*/
|
||||
public int getBase_time() {
|
||||
return base_time;
|
||||
}
|
||||
/**
|
||||
* @return the base_time
|
||||
*/
|
||||
public int getBase_time() {
|
||||
return base_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param base_time
|
||||
* the base_time to set
|
||||
*/
|
||||
public void setBase_time(int base_time) {
|
||||
this.base_time = base_time;
|
||||
}
|
||||
/**
|
||||
* @param base_time
|
||||
* the base_time to set
|
||||
*/
|
||||
public void setBase_time(int base_time) {
|
||||
this.base_time = base_time;
|
||||
}
|
||||
|
||||
public Calendar getTimeObs() {
|
||||
return timeObs;
|
||||
}
|
||||
public Calendar getTimeObs() {
|
||||
return timeObs;
|
||||
}
|
||||
|
||||
public void setTimeObs(Calendar timeObs) {
|
||||
this.timeObs = timeObs;
|
||||
}
|
||||
public void setTimeObs(Calendar timeObs) {
|
||||
this.timeObs = timeObs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the start_time_offset
|
||||
*/
|
||||
public double getStart_time_offset() {
|
||||
return start_time_offset;
|
||||
}
|
||||
/**
|
||||
* @return the start_time_offset
|
||||
*/
|
||||
public double getStart_time_offset() {
|
||||
return start_time_offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param start_time_offset
|
||||
* the start_time_offset to set
|
||||
*/
|
||||
public void setStart_time_offset(double start_time_offset) {
|
||||
this.start_time_offset = start_time_offset;
|
||||
}
|
||||
/**
|
||||
* @param start_time_offset
|
||||
* the start_time_offset to set
|
||||
*/
|
||||
public void setStart_time_offset(double start_time_offset) {
|
||||
this.start_time_offset = start_time_offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the end_time_offset
|
||||
*/
|
||||
public double getEnd_time_offset() {
|
||||
return end_time_offset;
|
||||
}
|
||||
/**
|
||||
* @return the end_time_offset
|
||||
*/
|
||||
public double getEnd_time_offset() {
|
||||
return end_time_offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param end_time_offset
|
||||
* the end_time_offset to set
|
||||
*/
|
||||
public void setEnd_time_offset(double end_time_offset) {
|
||||
this.end_time_offset = end_time_offset;
|
||||
}
|
||||
/**
|
||||
* @param end_time_offset
|
||||
* the end_time_offset to set
|
||||
*/
|
||||
public void setEnd_time_offset(double end_time_offset) {
|
||||
this.end_time_offset = end_time_offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nhts
|
||||
*/
|
||||
public int getNhts() {
|
||||
return nhts;
|
||||
}
|
||||
/**
|
||||
* @return the nhts
|
||||
*/
|
||||
public int getNhts() {
|
||||
return nhts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nhts
|
||||
* the nhts to set
|
||||
*/
|
||||
public void setNhts(int nhts) {
|
||||
this.nhts = nhts;
|
||||
}
|
||||
/**
|
||||
* @param nhts
|
||||
* the nhts to set
|
||||
*/
|
||||
public void setNhts(int nhts) {
|
||||
this.nhts = nhts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the levels
|
||||
*/
|
||||
public List<ProfilerLdadLevel> getLevels() {
|
||||
return levels;
|
||||
}
|
||||
/**
|
||||
* @return the levels
|
||||
*/
|
||||
public List<ProfilerLdadLevel> getLevels() {
|
||||
return levels;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param levels
|
||||
* the levels to set
|
||||
*/
|
||||
public void setLevels(List<ProfilerLdadLevel> levels) {
|
||||
this.levels = levels;
|
||||
}
|
||||
/**
|
||||
* @param levels
|
||||
* the levels to set
|
||||
*/
|
||||
public void setLevels(List<ProfilerLdadLevel> levels) {
|
||||
this.levels = levels;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the pointDataView
|
||||
*/
|
||||
@Override
|
||||
public PointDataView getPointDataView() {
|
||||
return pointDataView;
|
||||
}
|
||||
/**
|
||||
* @return the pointDataView
|
||||
*/
|
||||
@Override
|
||||
public PointDataView getPointDataView() {
|
||||
return pointDataView;
|
||||
}
|
||||
|
||||
public ProfilerLdadObs() {
|
||||
}
|
||||
public ProfilerLdadObs() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pointDataView
|
||||
* the pointDataView to set
|
||||
*/
|
||||
@Override
|
||||
public void setPointDataView(PointDataView pointDataView) {
|
||||
this.pointDataView = pointDataView;
|
||||
}
|
||||
/**
|
||||
* @param pointDataView
|
||||
* the pointDataView to set
|
||||
*/
|
||||
@Override
|
||||
public void setPointDataView(PointDataView pointDataView) {
|
||||
this.pointDataView = pointDataView;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------
|
||||
// ----------------------------------------------------
|
||||
|
||||
@Override
|
||||
public IDecoderGettable getDecoderGettable() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public IDecoderGettable getDecoderGettable() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpatialObject getSpatialObject() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ISpatialObject getSpatialObject() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getString(String paramName) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public String getString(String paramName) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getStrings(String paramName) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public String[] getStrings(String paramName) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Amount getValue(String paramName) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Amount getValue(String paramName) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Amount> getValues(String paramName) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Collection<Amount> getValues(String paramName) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param location
|
||||
* the location to set
|
||||
*/
|
||||
public void setLocation(SurfaceObsLocation location) {
|
||||
this.location = location;
|
||||
}
|
||||
/**
|
||||
* @param location
|
||||
* the location to set
|
||||
*/
|
||||
public void setLocation(SurfaceObsLocation location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the location
|
||||
*/
|
||||
public SurfaceObsLocation getLocation() {
|
||||
return location;
|
||||
}
|
||||
/**
|
||||
* @return the location
|
||||
*/
|
||||
public SurfaceObsLocation getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param stationName
|
||||
* the stationName to set
|
||||
*/
|
||||
public void setStationName(String stationName) {
|
||||
this.stationName = stationName;
|
||||
}
|
||||
/**
|
||||
* @param stationName
|
||||
* the stationName to set
|
||||
*/
|
||||
public void setStationName(String stationName) {
|
||||
this.stationName = stationName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the stationName
|
||||
*/
|
||||
public String getStationName() {
|
||||
return stationName;
|
||||
}
|
||||
/**
|
||||
* @return the stationName
|
||||
*/
|
||||
public String getStationName() {
|
||||
return stationName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param parameterName
|
||||
* the parameterName to set
|
||||
*/
|
||||
public void setParameterName(String parameterName) {
|
||||
this.parameterName = parameterName;
|
||||
}
|
||||
/**
|
||||
* @param parameterName
|
||||
* the parameterName to set
|
||||
*/
|
||||
public void setParameterName(String parameterName) {
|
||||
this.parameterName = parameterName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the parameterName
|
||||
*/
|
||||
public String getParameterName() {
|
||||
return parameterName;
|
||||
}
|
||||
/**
|
||||
* @return the parameterName
|
||||
*/
|
||||
public String getParameterName() {
|
||||
return parameterName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param reportType
|
||||
* the reportType to set
|
||||
*/
|
||||
public void setReportType(Integer reportType) {
|
||||
this.reportType = reportType;
|
||||
}
|
||||
/**
|
||||
* @param reportType
|
||||
* the reportType to set
|
||||
*/
|
||||
public void setReportType(Integer reportType) {
|
||||
this.reportType = reportType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the reportType
|
||||
*/
|
||||
public Integer getReportType() {
|
||||
return reportType;
|
||||
}
|
||||
/**
|
||||
* @return the reportType
|
||||
*/
|
||||
public Integer getReportType() {
|
||||
return reportType;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Column
|
||||
|
@ -397,4 +395,9 @@ public class ProfilerLdadObs extends PersistablePluginDataObject implements
|
|||
public String getDataURI() {
|
||||
return super.getDataURI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "ldadprofiler";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,21 +59,24 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 20080303 1026 jkorman Initial implementation.
|
||||
* 20080408 1039 jkorman Added traceId for tracing data.
|
||||
* 11/25/08 #1684 chammack Camel Refactor
|
||||
* 04/29/13 #1861 bkowal Create a separate Point Data Container for
|
||||
* every record so each forecast hour will
|
||||
* receive a unique hdf5 file.
|
||||
* 07/03/13 #2161 bkowal Store and retrieve the Point Data Containers
|
||||
* by forecast hour and reftime when completing
|
||||
* a decode operation. Overrode default
|
||||
* Point Data Container size.
|
||||
* 07/16/13 #2161 bkowal Store the records in a container that will
|
||||
* be persisted every X (configurable) seconds
|
||||
* by a timer. The timer is started during spring
|
||||
* initialization and destroyed during spring
|
||||
* container destruction.
|
||||
* Mar 03, 2008 1026 jkorman Initial implementation.
|
||||
* Apr 08, 2008 1039 jkorman Added traceId for tracing data.
|
||||
* Nov 25, 2008 1684 chammack Camel Refactor
|
||||
* Apr 29, 2013 1861 bkowal Create a separate Point Data Container
|
||||
* for every record so each forecast hour
|
||||
* will receive a unique hdf5 file.
|
||||
* Jul 03, 2013 2161 bkowal Store and retrieve the Point Data
|
||||
* Containers by forecast hour and reftime
|
||||
* when completing a decode operation.
|
||||
* Overrode default Point Data Container
|
||||
* size.
|
||||
* Jul 16, 2013 2161 bkowal Store the records in a container that
|
||||
* will be persisted every X (configurable)
|
||||
* seconds by a timer. The timer is started
|
||||
* during spring initialization and
|
||||
* destroyed during spring container
|
||||
* destruction.
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -219,7 +222,6 @@ public class ModelSoundingDecoder extends AbstractDecoder implements
|
|||
soundingTemporalData);
|
||||
if (soundingData != null) {
|
||||
soundingData.setTraceId(traceId);
|
||||
soundingData.setPluginName(PLUGIN_NAME);
|
||||
try {
|
||||
soundingData.constructDataURI();
|
||||
} catch (PluginException e) {
|
||||
|
|
|
@ -62,11 +62,13 @@ import com.vividsolutions.jts.geom.Geometry;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 20080303 1026 jkorman Initial implementation.
|
||||
* Apr 4, 2013 1846 bkowal Added an index on refTime and forecastTime
|
||||
* Apr 12, 2013 1857 bgonzale Added SequenceGenerator annotation.
|
||||
* Mar 03, 2008 1026 jkorman Initial implementation.
|
||||
* Apr 04, 2013 1846 bkowal Added an index on refTime and
|
||||
* forecastTime
|
||||
* Apr 12, 2013 1857 bgonzale Added SequenceGenerator annotation.
|
||||
* May 07, 2013 1869 bsteffen Remove dataURI column from
|
||||
* PluginDataObject.
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -911,10 +913,16 @@ public class SoundingSite extends PersistablePluginDataObject implements
|
|||
public void setPointDataView(PointDataView pointDataView) {
|
||||
this.pointDataView = pointDataView;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Column
|
||||
@Access(AccessType.PROPERTY)
|
||||
public String getDataURI() {
|
||||
return super.getDataURI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "modelsounding";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ Eclipse-RegisterBuddy: com.raytheon.edex.common, com.raytheon.uf.common.serializ
|
|||
Bundle-Vendor: RAYTHEON
|
||||
Export-Package: com.raytheon.edex.plugin.obs,
|
||||
com.raytheon.edex.plugin.obs.mesowest,
|
||||
com.raytheon.edex.plugin.obs.mesowest.util,
|
||||
com.raytheon.edex.plugin.obs.metar,
|
||||
com.raytheon.edex.plugin.obs.metar.util,
|
||||
com.raytheon.edex.uengine.tasks.obs
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
com.raytheon.edex.plugin.obs.mesowest.MesowestRecord
|
|
@ -3,9 +3,7 @@
|
|||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
|
||||
|
||||
<bean id="obsDecoder" class="com.raytheon.edex.plugin.obs.ObsDecoder">
|
||||
<constructor-arg ref="obsPluginName" />
|
||||
</bean>
|
||||
<bean id="obsDecoder" class="com.raytheon.edex.plugin.obs.ObsDecoder"/>
|
||||
|
||||
<bean id="metarPointData" class="com.raytheon.edex.plugin.obs.metar.MetarPointDataTransform"/>
|
||||
|
||||
|
|
|
@ -20,30 +20,6 @@
|
|||
|
||||
package com.raytheon.edex.plugin.obs;
|
||||
|
||||
/**
|
||||
* Decoder implementation for observation data types. This class provides a
|
||||
* wrapper in order to select the correct decoder based on the data type
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ----------- ---------- ----------- --------------------------
|
||||
* 4/27/07 199 bphillip Initial creation
|
||||
* 07/31/2007 411 jkorman Added addition logging
|
||||
* 08/10/2007 379 jkorman Added disposal behavior.
|
||||
* 20071217 453 jkorman Added code to check for duplicate obs.
|
||||
* 20080314 995 jkorman Changed setDecoderStrategy to check for
|
||||
* empty data.
|
||||
* 20080408 1039 jkorman Added traceId for tracing data.
|
||||
* Mar 19, 2013 1785 bgonzale Added performance status handler and added
|
||||
* status to decode.
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
|
@ -58,24 +34,40 @@ import com.raytheon.uf.common.time.util.ITimer;
|
|||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.edex.wmo.message.WMOHeader;
|
||||
|
||||
/**
|
||||
* Decoder implementation for observation data types. This class provides a
|
||||
* wrapper in order to select the correct decoder based on the data type
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ----------- ---------- ----------- --------------------------
|
||||
* Apr 27, 2007 199 bphillip Initial creation
|
||||
* Jul 31, 2007 411 jkorman Added addition logging
|
||||
* Aug 10, 2007 379 jkorman Added disposal behavior.
|
||||
* Dec 17, 2007 453 jkorman Added code to check for duplicate obs.
|
||||
* Mar 14, 2008 995 jkorman Changed setDecoderStrategy to check for
|
||||
* empty data.
|
||||
* Apr 08, 2008 1039 jkorman Added traceId for tracing data.
|
||||
* Mar 19, 2013 1785 bgonzale Added performance status handler and added
|
||||
* status to decode.
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
public class ObsDecoder extends AbstractDecoder {
|
||||
/** The logger */
|
||||
private Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private final String PLUGIN_NAME;
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private final IPerformanceStatusHandler perfLog = PerformanceStatus
|
||||
.getHandler("Obs:");
|
||||
|
||||
private String traceId = null;
|
||||
|
||||
/**
|
||||
* Required empty constructor.
|
||||
*/
|
||||
public ObsDecoder(String pluginName) {
|
||||
PLUGIN_NAME = pluginName;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return A decoded data record.
|
||||
|
@ -139,13 +131,13 @@ public class ObsDecoder extends AbstractDecoder {
|
|||
if ('S' == header.getT1()) {
|
||||
switch (header.getT2()) {
|
||||
case 'A': {
|
||||
decoder = new MetarDecoder(PLUGIN_NAME);
|
||||
((MetarDecoder) decoder).setTraceId(traceId);
|
||||
decoder = new MetarDecoder();
|
||||
decoder.setTraceId(traceId);
|
||||
break;
|
||||
}
|
||||
case 'P': {
|
||||
decoder = new MetarDecoder(PLUGIN_NAME);
|
||||
((MetarDecoder) decoder).setTraceId(traceId);
|
||||
decoder = new MetarDecoder();
|
||||
decoder.setTraceId(traceId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,150 +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.edex.plugin.obs.mesowest;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import com.raytheon.edex.esb.Headers;
|
||||
import com.raytheon.edex.exception.DecoderException;
|
||||
import com.raytheon.edex.plugin.AbstractDecoder;
|
||||
import com.raytheon.edex.util.Util;
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.edex.decodertools.core.DecoderTools;
|
||||
import com.raytheon.uf.edex.decodertools.time.TimeTools;
|
||||
|
||||
/**
|
||||
* Decoder implementation for mesowest plugin
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 02/14/06 139 bphillip Initial creation
|
||||
* 11/11/08 1684 chammack Refactored to camel interfaces
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
|
||||
public class MesowestDecoder extends AbstractDecoder {
|
||||
|
||||
private static final DecimalFormat DECIMALTENTHS = new DecimalFormat("#.#");
|
||||
|
||||
private static final DecimalFormat WHOLENUMBER = new DecimalFormat("#");
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public MesowestDecoder() throws DecoderException {
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.edex.plugin.IBinaryDecoder#decode(byte[])
|
||||
*/
|
||||
public PluginDataObject[] decode(byte[] data, Headers headers)
|
||||
throws DecoderException {
|
||||
|
||||
byte[] messageData = null;
|
||||
|
||||
String theMessage = new String(messageData);
|
||||
|
||||
MesowestRecord record = new MesowestRecord();
|
||||
record.setMessageData(theMessage);
|
||||
record.setPluginName("obs");
|
||||
record.setReportType("MESOWEST");
|
||||
record.setMessageData(theMessage);
|
||||
|
||||
String[] mwObs = theMessage.split(",");
|
||||
try {
|
||||
if (mwObs.length >= 7) {
|
||||
record.setStationID(mwObs[1]);
|
||||
String timeGroup = mwObs[6].substring(6, 8)
|
||||
+ mwObs[6].substring(9, 13) + "Z";
|
||||
String fileName = null;
|
||||
if (headers != null) {
|
||||
fileName = (String) headers
|
||||
.get(DecoderTools.INGEST_FILE_NAME);
|
||||
}
|
||||
record.setTimeObs(TimeTools
|
||||
.findCurrentTime(timeGroup, fileName));
|
||||
record.setDataTime(new DataTime(Util
|
||||
.findReferenceTime(timeGroup)));
|
||||
record.setRefHour(Util.findReferenceHour(timeGroup));
|
||||
}
|
||||
// Only want the observations in columns 7 through 15
|
||||
int mwArrayLength = mwObs.length < 17 ? mwObs.length : 17;
|
||||
for (int i = 7; i < mwArrayLength; i++) {
|
||||
if (i == 7 && mwObs[7].length() > 0) {
|
||||
double temp = calculateCelsius(mwObs[7]);
|
||||
record.setTemperature(Integer.parseInt(WHOLENUMBER
|
||||
.format(temp)));
|
||||
record.setTempFromTenths(Float.parseFloat(DECIMALTENTHS
|
||||
.format(temp)));
|
||||
} else if (i == 9 && mwObs[9].length() > 0) {
|
||||
double wSpeed = Double.valueOf(mwObs[9].trim())
|
||||
.doubleValue();
|
||||
record.setWindSpeed(Integer.parseInt(WHOLENUMBER
|
||||
.format(wSpeed)));
|
||||
} else if (i == 10 && mwObs[10].length() > 0) {
|
||||
double wGust = Double.valueOf(mwObs[10].trim())
|
||||
.doubleValue();
|
||||
record.setWindGust(Integer.parseInt(WHOLENUMBER
|
||||
.format(wGust)));
|
||||
} else if (i == 11 && mwObs[11].length() > 0) {
|
||||
record.setWindDir(mwObs[11]);
|
||||
} else if (i == 13 && mwObs[13].length() > 0) {
|
||||
double dewp = calculateCelsius(mwObs[13]);
|
||||
record.setDewPoint(Integer.parseInt(WHOLENUMBER
|
||||
.format(dewp)));
|
||||
record.setDewPointFromTenths(Float.parseFloat(DECIMALTENTHS
|
||||
.format(dewp)));
|
||||
} else if (i == 15 && mwObs[15].length() > 0) {
|
||||
record.setSeaLevelPress(Float.parseFloat(mwObs[15]));
|
||||
} else if (i == 16 && mwObs[16].length() > 0) {
|
||||
record.setAltimeter(Float.parseFloat(mwObs[16]));
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new DecoderException("Unable to decode Mesowest data", e);
|
||||
}
|
||||
|
||||
if (record == null)
|
||||
return new PluginDataObject[0];
|
||||
return new PluginDataObject[] { record };
|
||||
}
|
||||
|
||||
private double calculateCelsius(String tempString) {
|
||||
double temp = Double.valueOf(tempString.trim()).doubleValue();
|
||||
double tempC = (temp - 32.0) * (5.0 / 9.0);
|
||||
return tempC;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,361 +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.edex.plugin.obs.mesowest;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
import javax.persistence.Access;
|
||||
import javax.persistence.AccessType;
|
||||
import javax.persistence.Column;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
||||
/**
|
||||
* Record implementation for mesowest plugin
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 2/14/2007 139 Phillippe Initial creation
|
||||
* 20071129 472 jkorman Added IDecoderGettable interface.
|
||||
* May 07, 2013 1869 bsteffen Remove dataURI column from
|
||||
* PluginDataObject.
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@DynamicSerialize
|
||||
public class MesowestRecord extends PluginDataObject {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** A string denoting the report type */
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private String reportType;
|
||||
|
||||
/** A string denoting the reporting station */
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private String stationID;
|
||||
|
||||
/** A string denoting the time of observation */
|
||||
@XmlElement
|
||||
@DynamicSerializeElement
|
||||
private Calendar timeObs;
|
||||
|
||||
/** A string denoting the temperature in degrees Celsius */
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private Integer temperature;
|
||||
|
||||
/** A string denoting the current temperature in tenths of degrees Celsius */
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private Float tempFromTenths;
|
||||
|
||||
/** A string denoting the wind direction in degrees from north */
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private String windDir;
|
||||
|
||||
/** A string denoting the wind speed in knots */
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private Integer windSpeed;
|
||||
|
||||
/** A string denoting the wind gusts in knots */
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private Integer windGust;
|
||||
|
||||
/** A string denoting the current dew point in degrees Celsius */
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private Integer dewPoint;
|
||||
|
||||
/** A string denoting the current dew point in tenths of degrees Celsius */
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private Float dewPointFromTenths;
|
||||
|
||||
/** A string denoting the altimeter reading in in/Hg */
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private Float altimeter;
|
||||
|
||||
/** A string denoting the sea level pressure in millibars */
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private Float seaLevelPress;
|
||||
|
||||
/** The reference hour * */
|
||||
@XmlElement
|
||||
@DynamicSerializeElement
|
||||
private Calendar refHour;
|
||||
|
||||
/**
|
||||
* No argument constructor
|
||||
*
|
||||
*/
|
||||
public MesowestRecord() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a mesowest record from a dataURI
|
||||
*
|
||||
* @param uri
|
||||
* The dataURI
|
||||
* @param tableDef
|
||||
* The table definition associated with this class
|
||||
*/
|
||||
public MesowestRecord(String uri) {
|
||||
super(uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the reportType
|
||||
*/
|
||||
public String getReportType() {
|
||||
return reportType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param reportType
|
||||
* the reportType to set
|
||||
*/
|
||||
public void setReportType(String reportType) {
|
||||
this.reportType = reportType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the altimeter
|
||||
*/
|
||||
public Float getAltimeter() {
|
||||
return altimeter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param altimeter
|
||||
* the altimeter to set
|
||||
*/
|
||||
public void setAltimeter(Float altimeter) {
|
||||
this.altimeter = altimeter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dewPoint
|
||||
*/
|
||||
public Integer getDewPoint() {
|
||||
return dewPoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dewPoint
|
||||
* the dewPoint to set
|
||||
*/
|
||||
public void setDewPoint(Integer dewPoint) {
|
||||
this.dewPoint = dewPoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dewPointFromTenths
|
||||
*/
|
||||
public Float getDewPointFromTenths() {
|
||||
return dewPointFromTenths;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dewPointFromTenths
|
||||
* the dewPointFromTenths to set
|
||||
*/
|
||||
public void setDewPointFromTenths(Float dewPointFromTenths) {
|
||||
this.dewPointFromTenths = dewPointFromTenths;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the refHour
|
||||
*/
|
||||
public Calendar getRefHour() {
|
||||
return refHour;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param refHour
|
||||
* the refHour to set
|
||||
*/
|
||||
public void setRefHour(Calendar refHour) {
|
||||
this.refHour = refHour;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the seaLevelPress
|
||||
*/
|
||||
public Float getSeaLevelPress() {
|
||||
return seaLevelPress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param seaLevelPress
|
||||
* the seaLevelPress to set
|
||||
*/
|
||||
public void setSeaLevelPress(Float seaLevelPress) {
|
||||
this.seaLevelPress = seaLevelPress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the stationID
|
||||
*/
|
||||
public String getStationID() {
|
||||
return stationID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param stationID
|
||||
* the stationID to set
|
||||
*/
|
||||
public void setStationID(String stationID) {
|
||||
this.stationID = stationID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the temperature
|
||||
*/
|
||||
public Integer getTemperature() {
|
||||
return temperature;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param temperature
|
||||
* the temperature to set
|
||||
*/
|
||||
public void setTemperature(Integer temperature) {
|
||||
this.temperature = temperature;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the tempFromTenths
|
||||
*/
|
||||
public Float getTempFromTenths() {
|
||||
return tempFromTenths;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tempFromTenths
|
||||
* the tempFromTenths to set
|
||||
*/
|
||||
public void setTempFromTenths(Float tempFromTenths) {
|
||||
this.tempFromTenths = tempFromTenths;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the timeObs
|
||||
*/
|
||||
public Calendar getTimeObs() {
|
||||
return timeObs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param timeObs
|
||||
* the timeObs to set
|
||||
*/
|
||||
public void setTimeObs(Calendar timeObs) {
|
||||
this.timeObs = timeObs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the windDir
|
||||
*/
|
||||
public String getWindDir() {
|
||||
return windDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param windDir
|
||||
* the windDir to set
|
||||
*/
|
||||
public void setWindDir(String windDir) {
|
||||
this.windDir = windDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the windGust
|
||||
*/
|
||||
public Integer getWindGust() {
|
||||
return windGust;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param windGust
|
||||
* the windGust to set
|
||||
*/
|
||||
public void setWindGust(Integer windGust) {
|
||||
this.windGust = windGust;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the windSpeed
|
||||
*/
|
||||
public Integer getWindSpeed() {
|
||||
return windSpeed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param windSpeed
|
||||
* the windSpeed to set
|
||||
*/
|
||||
public void setWindSpeed(Integer windSpeed) {
|
||||
this.windSpeed = windSpeed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the IDecoderGettable reference for this record.
|
||||
*
|
||||
* @return The IDecoderGettable reference for this record. Null for this
|
||||
* class.
|
||||
*/
|
||||
public IDecoderGettable getDecoderGettable() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Column
|
||||
@Access(AccessType.PROPERTY)
|
||||
public String getDataURI() {
|
||||
return super.getDataURI();
|
||||
}
|
||||
}
|
|
@ -54,29 +54,30 @@ import com.vividsolutions.jts.geom.impl.CoordinateArraySequence;
|
|||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* ate Ticket# Engineer Description
|
||||
* ----------- ---------- ----------- --------------------------
|
||||
* 2/14/07 139 bphillip Initial creation
|
||||
* 20071029 505 jkorman Changed setting of DataTime from refhour
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 14, 2007 139 bphillip Initial creation
|
||||
* Oct 29, 2007 505 jkorman Changed setting of DataTime from refhour
|
||||
* to observation time.
|
||||
* 20071128 575 jkorman Added future obs time threshold check in
|
||||
* Nov 28, 2007 575 jkorman Added future obs time threshold check in
|
||||
* decode.
|
||||
* 12/07/07 452 bphillip Retrieve lat/lon info from station table
|
||||
* 12/17/07 628 bphillip Discarding data with no station info
|
||||
* 20071217 453 jkorman Major restructure of the decode method
|
||||
* Dec 07, 2007 452 bphillip Retrieve lat/lon info from station table
|
||||
* Dec 17, 2007 628 bphillip Discarding data with no station info
|
||||
* Dec 17, 2007 453 jkorman Major restructure of the decode method
|
||||
* to ensure that all sections are decoded
|
||||
* properly. Added cleanMessage method.
|
||||
* 20071218 453 jkorman Added metric winds and visibility.
|
||||
* 20071221 665 jkorman Modified metric vis to ensure it is not
|
||||
* Dec 18, 2007 453 jkorman Added metric winds and visibility.
|
||||
* Dec 21, 2007 665 jkorman Modified metric vis to ensure it is not
|
||||
* decoding alstg data. Added checks for
|
||||
* NSC, NCD, and CAVOK. Added checks for
|
||||
* metric sector vis.
|
||||
* 20080102 667 jkorman Added code to properly decode/store clear
|
||||
* sky conditions.
|
||||
* 20080116 798 jkorman Changed logging levels.
|
||||
* 20080414 996 jkorman Rewrote sky cover decode section to handle
|
||||
* CB/TCU and /// data.
|
||||
* 11/11/08 1684 chammack Camel refactor.
|
||||
* Jan 02, 2008 667 jkorman Added code to properly decode/store
|
||||
* clear sky conditions.
|
||||
* Jan 16, 2008 798 jkorman Changed logging levels.
|
||||
* Apr 14, 2008 996 jkorman Rewrote sky cover decode section to
|
||||
* handle CB/TCU and /// data.
|
||||
* Nov 11, 2008 1684 chammack Camel refactor.
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -185,8 +186,6 @@ public class MetarDecoder extends AbstractDecoder {
|
|||
public static final Pattern SUNSHINE = Pattern
|
||||
.compile("(\\b)98(\\d{3}|///)");
|
||||
|
||||
private final String PLUGIN_NAME;
|
||||
|
||||
private boolean useMockInfo = false;
|
||||
|
||||
private ObStation mockInfo = null;
|
||||
|
@ -195,8 +194,7 @@ public class MetarDecoder extends AbstractDecoder {
|
|||
|
||||
private String traceId = null;
|
||||
|
||||
public MetarDecoder(String pluginName) throws DecoderException {
|
||||
PLUGIN_NAME = pluginName;
|
||||
public MetarDecoder() {
|
||||
VIS_PARSER = new VisibilityParser();
|
||||
}
|
||||
|
||||
|
@ -924,7 +922,6 @@ public class MetarDecoder extends AbstractDecoder {
|
|||
record.setSunshine(value);
|
||||
}
|
||||
|
||||
record.setPluginName(PLUGIN_NAME);
|
||||
record.constructDataURI();
|
||||
|
||||
record.setWmoHeader(sep.getWMOHeader().getWmoHeader());
|
||||
|
@ -1008,7 +1005,7 @@ public class MetarDecoder extends AbstractDecoder {
|
|||
StringBuilder sb = null;
|
||||
if (data != null) {
|
||||
sb = new StringBuilder(data);
|
||||
for (int i = 0; i < sb.length() - 1; i++) {
|
||||
for (int i = 0; i < (sb.length() - 1); i++) {
|
||||
if (sb.charAt(i) == '0') {
|
||||
sb.setCharAt(i, ' ');
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools;
|
|||
* dimensioned size.
|
||||
* May 09, 2013 1869 bsteffen Modified D2D time series of point data to
|
||||
* work without dataURI.
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -68,7 +69,7 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools;
|
|||
|
||||
public class MetarPointDataTransform {
|
||||
|
||||
public static final String ALTIMETER = "altimeter";
|
||||
public static final String ALTIMETER = "altimeter";
|
||||
|
||||
public static final String SEA_LEVEL_PRESS = "seaLevelPress";
|
||||
|
||||
|
@ -232,8 +233,9 @@ public class MetarPointDataTransform {
|
|||
Map<File, PointDataContainer> pointMap = new HashMap<File, PointDataContainer>();
|
||||
|
||||
for (PluginDataObject p : pdo) {
|
||||
if (!(p instanceof MetarRecord))
|
||||
if (!(p instanceof MetarRecord)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
File f = this.dao.getFullFilePath(p);
|
||||
PointDataContainer pdc = pointMap.get(f);
|
||||
|
@ -254,7 +256,7 @@ public class MetarPointDataTransform {
|
|||
MetarRecord record) {
|
||||
PointDataView pdv = container.append();
|
||||
|
||||
if (record.getCorrection() != null
|
||||
if ((record.getCorrection() != null)
|
||||
&& record.getCorrection().equals("COR")) {
|
||||
pdv.setInt(CORRECTION, 1);
|
||||
} else {
|
||||
|
@ -272,12 +274,12 @@ public class MetarPointDataTransform {
|
|||
|
||||
if (record.getSkyCoverage() != null) {
|
||||
int maxSize = container.getDescription(SKY_COVER)
|
||||
.getDimensionAsInt();
|
||||
.getDimensionAsInt();
|
||||
record.sort(record.getSkyCoverage());
|
||||
Iterator<SkyCover> scIterator = record.getSkyCoverage().iterator();
|
||||
int i = 0;
|
||||
while (scIterator.hasNext()) {
|
||||
if(i >= maxSize) {
|
||||
if (i >= maxSize) {
|
||||
break;
|
||||
}
|
||||
// TODO: storing duplicate info like this, needs to be resolved
|
||||
|
@ -285,8 +287,9 @@ public class MetarPointDataTransform {
|
|||
if (sc.getType() != null) {
|
||||
StringBuffer scBuffer = new StringBuffer();
|
||||
scBuffer.append(sc.getType());
|
||||
if (sc.getGenus() != null)
|
||||
if (sc.getGenus() != null) {
|
||||
scBuffer.append(sc.getGenus());
|
||||
}
|
||||
|
||||
pdv.setString(SKY_COVER, scBuffer.toString(), i);
|
||||
if (sc.getType() != null) {
|
||||
|
@ -346,7 +349,7 @@ public class MetarPointDataTransform {
|
|||
pdv.setFloat(SNOWFALL6_HOUR, record.getSnowFall_6Hours());
|
||||
pdv.setInt(SUNSHINE, record.getSunshine());
|
||||
|
||||
if (record.getWindDir() != null
|
||||
if ((record.getWindDir() != null)
|
||||
&& !record.getWindDir().equalsIgnoreCase("VRB")) {
|
||||
pdv.setFloat("windDir", Float.parseFloat(record.getWindDir()));
|
||||
}
|
||||
|
@ -415,7 +418,6 @@ public class MetarPointDataTransform {
|
|||
mr.setPressChange3Hour(pdv.getNumber(PRESS_CHANGE3_HOUR).floatValue());
|
||||
mr.setPressChangeChar(pdv.getString(PRESS_CHANGE_CHAR));
|
||||
|
||||
mr.setPluginName("obs");
|
||||
mr.setPrecip1Hour(pdv.getNumber(PRECIP1_HOUR).floatValue());
|
||||
mr.setPrecip3Hour(pdv.getNumber(PRECIP3_HOUR).floatValue());
|
||||
mr.setPrecip6Hour(pdv.getNumber(PRECIP6_HOUR).floatValue());
|
||||
|
@ -427,7 +429,7 @@ public class MetarPointDataTransform {
|
|||
int i = 0;
|
||||
Set<SkyCover> scList = new HashSet<SkyCover>();
|
||||
for (String s : scType) {
|
||||
if (s != null && !s.equals("")) {
|
||||
if ((s != null) && !s.equals("")) {
|
||||
|
||||
SkyCover skyCover = new SkyCover();
|
||||
skyCover.setType(s);
|
||||
|
|
|
@ -59,10 +59,11 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 20080103 384 jkorman Initial Coding.
|
||||
* 20080128 861 jkorman Add pirep layer data.
|
||||
* 20080408 1039 jkorman Added traceId for tracing data.
|
||||
* 11/13/08 1684 chammack Camel Refactor
|
||||
* Jan 03, 2008 384 jkorman Initial Coding.
|
||||
* Jan 28, 2008 861 jkorman Add pirep layer data.
|
||||
* Apr 08, 2008 1039 jkorman Added traceId for tracing data.
|
||||
* Nov 13, 2008 1684 chammack Camel Refactor
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
* </pre>
|
||||
*
|
||||
* @author jkorman
|
||||
|
@ -108,7 +109,6 @@ public class PirepDecoder extends AbstractDecoder {
|
|||
|
||||
if (report != null) {
|
||||
report.setTraceId(traceId);
|
||||
report.setPluginName(PLUGIN_NAME);
|
||||
try {
|
||||
report.constructDataURI();
|
||||
} catch (PluginException e) {
|
||||
|
@ -181,8 +181,7 @@ public class PirepDecoder extends AbstractDecoder {
|
|||
record.setHorzVisibility(parser.getHorxVisibility());
|
||||
|
||||
// Collect the decoded icing flight conditions data
|
||||
List<AircraftFlightCondition> icing = parser
|
||||
.getIcingLayers();
|
||||
List<AircraftFlightCondition> icing = parser.getIcingLayers();
|
||||
if (icing != null) {
|
||||
PirepLayerData iceLayer = null;
|
||||
for (AircraftFlightCondition layer : icing) {
|
||||
|
@ -250,7 +249,7 @@ public class PirepDecoder extends AbstractDecoder {
|
|||
}
|
||||
if (traceIdx >= 0) {
|
||||
newTrace = new StackTraceElement[traceIdx + 1];
|
||||
for (int j = 0; j < traceIdx + 1; j++) {
|
||||
for (int j = 0; j < (traceIdx + 1); j++) {
|
||||
newTrace[j] = trace[j];
|
||||
}
|
||||
e.setStackTrace(newTrace);
|
||||
|
|
|
@ -57,6 +57,7 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
|
|||
* Mar 03, 2008 1026 jkorman Initial implementation.
|
||||
* Apr 08, 2008 1039 jkorman Added traceId for tracing data.
|
||||
* May 15, 2013 1869 bsteffen Remove DataURI from goes/poes soundings.
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -70,7 +71,7 @@ public class POESSoundingDecoder extends AbstractDecoder implements
|
|||
public static final String PLUGIN_NAME = "poessounding";
|
||||
|
||||
/** The logger */
|
||||
private Log logger = LogFactory.getLog(getClass());
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private PointDataDescription pdd;
|
||||
|
||||
|
@ -118,7 +119,7 @@ public class POESSoundingDecoder extends AbstractDecoder implements
|
|||
|
||||
PluginDataObject[] decodedData = null;
|
||||
|
||||
if (data != null && data.length > 0) {
|
||||
if ((data != null) && (data.length > 0)) {
|
||||
|
||||
WMOHeader wmoHeader = new WMOHeader(data, headers);
|
||||
|
||||
|
@ -144,7 +145,6 @@ public class POESSoundingDecoder extends AbstractDecoder implements
|
|||
container);
|
||||
if (soundingData != null) {
|
||||
soundingData.setTraceId(traceId);
|
||||
soundingData.setPluginName(PLUGIN_NAME);
|
||||
pdoList.add(soundingData);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,8 +56,9 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 20080303 969 jkorman Initial implementation.
|
||||
* 20080408 1039 jkorman Added traceId for tracing data.
|
||||
* Mar 03, 2008 969 jkorman Initial implementation.
|
||||
* Apr 08, 2008 1039 jkorman Added traceId for tracing data.
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -71,7 +72,7 @@ public class ProfilerDecoder extends AbstractDecoder implements
|
|||
public static final String PLUGIN_NAME = "profiler";
|
||||
|
||||
/** The logger */
|
||||
private Log logger = LogFactory.getLog(getClass());
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private PointDataDescription pdd;
|
||||
|
||||
|
@ -131,7 +132,7 @@ public class ProfilerDecoder extends AbstractDecoder implements
|
|||
|
||||
PluginDataObject[] decodedData = null;
|
||||
|
||||
if (data != null && data.length > 0) {
|
||||
if ((data != null) && (data.length > 0)) {
|
||||
|
||||
WMOHeader wmoHeader = new WMOHeader(data, headers);
|
||||
if ((wmoHeader != null) && (wmoHeader.isValid())) {
|
||||
|
@ -160,7 +161,6 @@ public class ProfilerDecoder extends AbstractDecoder implements
|
|||
container, traceId);
|
||||
if (soundingData != null) {
|
||||
soundingData.setTraceId(traceId);
|
||||
soundingData.setPluginName(PLUGIN_NAME);
|
||||
try {
|
||||
soundingData.constructDataURI();
|
||||
PointDataView view = soundingData
|
||||
|
|
|
@ -87,12 +87,15 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 2/14/2007 139 Phillippe Initial check-in. Refactor of initial implementation.
|
||||
* Feb 14, 2007 139 Phillippe Initial check-in. Refactor of initial
|
||||
* implementation.
|
||||
* Dec 17, 2007 600 bphillip Added dao pool usage
|
||||
* Dec 03, 2010 2235 cjeanbap EDEXUtility.sendMessageAlertViz() signature changed.
|
||||
* Dec 03, 2010 2235 cjeanbap EDEXUtility.sendMessageAlertViz()
|
||||
* signature changed.
|
||||
* Mar 19, 2013 1804 bsteffen Optimize decoder performance.
|
||||
* Mar 19, 2013 1785 bgonzale Added performance status handler and added status
|
||||
* to decode.
|
||||
* Mar 19, 2013 1785 bgonzale Added performance status handler and
|
||||
* added status to decode.
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -130,7 +133,7 @@ public class RadarDecoder extends AbstractDecoder {
|
|||
|
||||
private String traceId = "";
|
||||
|
||||
private RadarInfoDict infoDict;
|
||||
private final RadarInfoDict infoDict;
|
||||
|
||||
private RadarStationDao radarStationDao = new RadarStationDao();
|
||||
|
||||
|
@ -541,7 +544,6 @@ public class RadarDecoder extends AbstractDecoder {
|
|||
|
||||
private void finalizeRecord(RadarRecord record) throws PluginException {
|
||||
record.setTraceId(traceId);
|
||||
record.setPluginName("radar");
|
||||
record.constructDataURI();
|
||||
record.setInsertTime(TimeTools.getSystemCalendar());
|
||||
// for GSM, we want all the messages as they have the possibility of
|
||||
|
@ -562,7 +564,7 @@ public class RadarDecoder extends AbstractDecoder {
|
|||
if (symbologyBlock == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int packetsKept = 0;
|
||||
|
||||
List<Layer> packetsInLyrs = new ArrayList<Layer>();
|
||||
|
@ -587,9 +589,9 @@ public class RadarDecoder extends AbstractDecoder {
|
|||
GenericDataPacket genericPacket = (GenericDataPacket) packet;
|
||||
List<GenericDataComponent> components = genericPacket
|
||||
.getComponents();
|
||||
if (components != null
|
||||
&& components.size() == 1
|
||||
&& components.get(0).getComponentType() == ComponentType.RADIAL) {
|
||||
if ((components != null)
|
||||
&& (components.size() == 1)
|
||||
&& (components.get(0).getComponentType() == ComponentType.RADIAL)) {
|
||||
processRadialComponent(record,
|
||||
(RadialComponent) components.get(0));
|
||||
} else {
|
||||
|
@ -698,7 +700,7 @@ public class RadarDecoder extends AbstractDecoder {
|
|||
ClusterTask task = ClusterLockUtils.lookupLock(lockname,
|
||||
record.getIcao());
|
||||
String formatStatus = RadarUtil.formatBits(messagePart, constants);
|
||||
if (task == null || task.getExtraInfo() == null) {
|
||||
if ((task == null) || (task.getExtraInfo() == null)) {
|
||||
ClusterLockUtils.lock(lockname, record.getIcao(), formatStatus, 30,
|
||||
true);
|
||||
EDEXUtil.sendMessageAlertViz(Priority.INFO,
|
||||
|
@ -711,7 +713,7 @@ public class RadarDecoder extends AbstractDecoder {
|
|||
}
|
||||
|
||||
if (task.getExtraInfo() != null) {
|
||||
if (formatStatus != null
|
||||
if ((formatStatus != null)
|
||||
&& !formatStatus.equals(task.getExtraInfo().trim())) {
|
||||
String details = "";
|
||||
String temp = "";
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue