1 23 24 package org.enhydra.kelp.forte; 25 26 import org.openide.options.SystemOption; 27 import org.openide.util.HelpCtx; 28 import org.openide.util.NbBundle; 29 30 import org.enhydra.kelp.common.node.PropertyKeys; 31 import org.enhydra.kelp.common.PropUtil; 32 33 import java.util.Hashtable ; 34 import java.io.*; 35 39 public class DodsSettings extends SystemOption implements PropertyKeys{ 40 41 static final long serialVersionUID = 8806955980938332585L; 42 43 protected Hashtable nodeProps = null; 44 45 public String displayName () { 46 return NbBundle.getMessage (DodsSettings.class, "LBL_deploy_settings"); 47 } 48 49 public HelpCtx getHelpCtx () { 50 return HelpCtx.DEFAULT_HELP; 51 } 54 55 56 public static DodsSettings getDefault () 57 { 58 return (DodsSettings) findObject (DodsSettings.class, true); 59 } 60 61 public void writeExternal (ObjectOutput out) throws IOException { 62 out.writeObject(propertyValue("DodsParameters")); 63 out.writeObject(propertyValue("DomlFilepath")); 64 out.writeObject(propertyValue("enhydra.dods.java.project.path")); 65 out.writeObject(propertyValue("DodsEnhydraPath")); 66 } 67 68 public void readExternal (ObjectInput in) throws IOException, ClassNotFoundException { 69 setProperty("DodsParameters", (String )in.readObject()); 70 setProperty("DomlFilepath", (String )in.readObject()); 71 setProperty("enhydra.dods.java.project.path", (String )in.readObject()); 72 setProperty("DodsEnhydraPath", (String )in.readObject()); 73 74 } 75 76 public void setProperty(String key, String value) 77 { 78 putProperty(key, value, true); 79 } 80 81 public String propertyValue(String key) 82 { 83 return (String )getProperty(key); 84 } 85 86 public void setNodeProperty(String key, String prop) 87 { 88 if (nodeProps == null) 89 nodeProps = new Hashtable (); 90 91 if (prop != null) 92 try { 93 nodeProps.put(key, prop); 94 }catch (NullPointerException e) { 95 System.err.println(e); 96 } 97 else 98 nodeProps.remove(key); 99 } 100 101 public String getNodeProperty(String key) 102 { 103 if (nodeProps != null) 104 { 105 String res = (String )nodeProps.get(key); 106 return res; 107 } 108 109 return null; 110 } 111 112 public String getDeployRoot() 113 { 114 return propertyValue(DEPLOY_PATH_ROOT); 115 } 116 117 public void setDeployRoot(String root) 118 { 119 setProperty(DEPLOY_PATH_ROOT, root); 120 } 121 122 public boolean isGlobal() 123 { 124 return false; 125 } 126 } 127 128 129 | Popular Tags |