001/* 002 * This file is part of McIDAS-V 003 * 004 * Copyright 2007-2024 005 * Space Science and Engineering Center (SSEC) 006 * University of Wisconsin - Madison 007 * 1225 W. Dayton Street, Madison, WI 53706, USA 008 * https://www.ssec.wisc.edu/mcidas/ 009 * 010 * All Rights Reserved 011 * 012 * McIDAS-V is built on Unidata's IDV and SSEC's VisAD libraries, and 013 * some McIDAS-V source code is based on IDV and VisAD source code. 014 * 015 * McIDAS-V is free software; you can redistribute it and/or modify 016 * it under the terms of the GNU Lesser Public License as published by 017 * the Free Software Foundation; either version 3 of the License, or 018 * (at your option) any later version. 019 * 020 * McIDAS-V is distributed in the hope that it will be useful, 021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 023 * GNU Lesser Public License for more details. 024 * 025 * You should have received a copy of the GNU Lesser Public License 026 * along with this program. If not, see https://www.gnu.org/licenses/. 027 */ 028package edu.wisc.ssec.mcidasv.supportform; 029 030import edu.wisc.ssec.mcidasv.Constants; 031import ucar.unidata.idv.IntegratedDataViewer; 032import ucar.unidata.util.LogUtil; 033 034public class IdvStateCollector implements StateCollector { 035 036 private IntegratedDataViewer idv; 037 038 private static final String BUNDLE_FILENAME = "bundle" + Constants.SUFFIX_MCV; 039 private static final String EXTRA_FILENAME = "extra.html"; 040 041 public IdvStateCollector(IntegratedDataViewer idv) { 042 this.idv = idv; 043 } 044 045 public String getBundleAttachmentName() { 046 return BUNDLE_FILENAME; 047 } 048 049 public String getExtraAttachmentName() { 050 return EXTRA_FILENAME; 051 } 052 053 public String getContentsAsString() { 054 return ""; 055 } 056 057 public byte[] getContents() { 058 return getContentsAsString().getBytes(); 059 } 060 061 public String toString() { 062 return String.format("[IdvStateCollector@%x: canBundleState=%s, bundle=%s, extra=%s]", hashCode(), canBundleState(), getBundleAttachmentName(), getExtraAttachmentName()); 063 } 064 065 public boolean canBundleState() { 066 return true; 067 } 068 069 public byte[] getBundledState() { 070 String data = ""; 071 try { 072 data = idv.getPersistenceManager().getBundleXml(true); 073 } catch (Exception e) { 074 LogUtil.logException("Error saving state for support request", e); 075 } 076 return data.getBytes(); 077 } 078 079 public String getLogPath() { 080 return ""; 081 } 082 083 public String getPrefsPath() { 084 return ""; 085 } 086 087 public String getResolvSrvPath() { 088 return ""; 089 } 090 091}