001/* 002 * This file is part of McIDAS-V 003 * 004 * Copyright 2007-2023 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 http://www.gnu.org/licenses. 027 */ 028package edu.wisc.ssec.mcidasv.supportform; 029 030import java.util.Properties; 031import java.util.Map.Entry; 032 033// test/example only! use something else! 034public class SimpleStateCollector implements StateCollector { 035 036 public String getBundleAttachmentName() { 037 return "empty.mcv"; 038 } 039 040 public String getExtraAttachmentName() { 041 return "system.properties"; 042 } 043 044 public String getContentsAsString() { 045 StringBuffer buf = new StringBuffer(); 046 Properties props = System.getProperties(); 047 for (Entry<Object, Object> entry : props.entrySet()) { 048 buf.append(entry.getKey()+"="+entry.getValue()+"\n"); 049 } 050 return buf.toString(); 051 } 052 053 public byte[] getContents() { 054 return getContentsAsString().getBytes(); 055 } 056 057 public String toString() { 058 return String.format("[SimpleStateCollector@%x: canBundleState=%s, bundle=%s, extra=%s]", hashCode(), canBundleState(), getBundleAttachmentName(), getExtraAttachmentName()); 059 } 060 061 public boolean canBundleState() { 062 return false; 063 } 064 065 public byte[] getBundledState() { 066 return "".getBytes(); 067 } 068 069 public String getLogPath() { 070 return ""; 071 } 072 073 public String getPrefsPath() { 074 return ""; 075 } 076 077 public String getResolvSrvPath() { 078 return ""; 079 } 080 081}