1 package org.catacomb.interlish.service; 2 3 import java.io.File; 4 5 import org.catacomb.report.E; 6 7 8 public class AppPersist { 9 10 static AppPersistProvider approv; 11 12 static String applicationName = "catacomb"; 13 14 15 public static void setProvider(AppPersistProvider app) { 16 approv = app; 17 } 18 19 20 public static void checkProvider() { 21 if (approv == null) { 22 E.warning("no app persist provider"); 23 } 24 } 25 26 27 public static boolean hasValueFor(String pel) { 28 boolean ret = false; 29 checkProvider(); 30 if (approv != null) { 31 ret = approv.hasValueFor(pel); 32 } 33 return ret; 34 } 35 36 public static String getValueFor(String pel) { 37 String ret = null; 38 checkProvider(); 39 if (approv != null) { 40 ret = approv.getValueFor(pel); 41 } 42 return ret; 43 } 44 45 public static void forceExit() { 46 checkProvider(); 47 if (approv != null) { 48 approv.forceExit(); 49 } 50 } 51 52 53 public static void setValue(String lab, String val) { 54 checkProvider(); 55 if (approv != null) { 56 approv.setValue(lab, val); 57 } 58 59 } 60 61 62 public static void addRecentFile(File f) { 63 checkProvider(); 64 if (approv != null) { 65 approv.addRecentFile(f); 66 } 67 68 } 69 70 71 public static boolean hasValue(String tag, String val) { 72 boolean ret = false; 73 checkProvider(); 74 if (approv != null) { 75 ret = approv.hasValue(tag, val); 76 } 77 return ret; 78 } 79 80 81 public void setApplicationName(String s) { 82 applicationName = s; 83 } 84 85 public static String getApplicationName() { 86 return applicationName; 87 } 88 89 90 public static String[] getRecentPaths() { 91 String[] ret = new String[0]; 92 checkProvider(); 93 if (approv != null) { 94 ret = approv.getRecentPaths(); 95 } 96 return ret; 97 } 98 99 100 101 102 103 }