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 DeploySettings 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 (DeploySettings.class, "LBL_deploy_settings"); 47 } 48 49 public HelpCtx getHelpCtx () { 50 return HelpCtx.DEFAULT_HELP; 51 } 54 55 56 public static DeploySettings getDefault () 57 { 58 return (DeploySettings) findObject (DeploySettings.class, true); 59 } 60 61 public void writeExternal (ObjectOutput out) throws IOException { 62 out.writeObject(propertyValue(DEPLOY_CONTENT_TYPES)); 63 out.writeObject(propertyValue(DEPLOY_CONTENT_ENABLE)); 64 out.writeObject(propertyValue(DEPLOY_TYPE)); 65 out.writeObject(propertyValue(DEPLOY_BUILD)); 66 out.writeObject(propertyValue(DEPLOY_ECHO)); 67 out.writeObject(propertyValue(DEPLOY_OVERWRITE)); 68 out.writeObject(propertyValue(DEPLOY_PATH_ROOT)); 69 out.writeObject(propertyValue(DEPLOY_PATH_BOOTSTRAP)); 70 out.writeObject(propertyValue(DEPLOY_INPUT_FILTER)); 71 out.writeObject(propertyValue(DEPLOY_INPUT_ENABLE)); 72 out.writeObject(propertyValue(DEPLOY_PATH_INPUT)); 73 out.writeObject(propertyValue(DEPLOY_PATH_RESOURCE)); 74 out.writeObject(propertyValue(DEPLOY_TABLE_LENGTH)); 75 out.writeObject(propertyValue(DEPLOY_TABLE_FIND)); 76 out.writeObject(propertyValue(DEPLOY_TABLE_REPLACE)); 77 out.writeObject(propertyValue(DEPLOY_STARTUP_JAVA)); 78 out.writeObject(propertyValue(DEPLOY_STARTUP_RUN)); 79 out.writeObject(propertyValue(ARCHIVE_PROPERTIES)); 80 out.writeObject(propertyValue(AUTO_DEPLOY_FILE)); 81 out.writeObject(nodeProps); 82 out.writeObject(propertyValue(NAME_WORKING_DIR)); 83 out.writeObject(propertyValue(NAME_AUTO_PACK)); 84 out.writeObject(propertyValue(NAME_LIBRARIES)); 85 out.writeObject(propertyValue(NAME_GENTO)); 86 out.writeObject(propertyValue(DODS_PROJECT_JAVA_PATH)); 87 } 88 89 public void readExternal (ObjectInput in) throws IOException, ClassNotFoundException { 90 setProperty(DEPLOY_CONTENT_TYPES, (String )in.readObject()); 91 setProperty(DEPLOY_CONTENT_ENABLE, (String )in.readObject()); 92 setProperty(DEPLOY_TYPE, (String )in.readObject()); 93 setProperty(DEPLOY_BUILD, (String )in.readObject()); 94 setProperty(DEPLOY_ECHO, (String )in.readObject()); 95 setProperty(DEPLOY_OVERWRITE, (String )in.readObject()); 96 setProperty(DEPLOY_PATH_ROOT, (String )in.readObject()); 97 setProperty(DEPLOY_PATH_BOOTSTRAP, (String )in.readObject()); 98 setProperty(DEPLOY_INPUT_FILTER, (String )in.readObject()); 99 setProperty(DEPLOY_INPUT_ENABLE, (String )in.readObject()); 100 setProperty(DEPLOY_PATH_INPUT, (String )in.readObject()); 101 setProperty(DEPLOY_PATH_RESOURCE, (String )in.readObject()); 102 setProperty(DEPLOY_TABLE_LENGTH, (String )in.readObject()); 103 setProperty(DEPLOY_TABLE_FIND, (String )in.readObject()); 104 setProperty(DEPLOY_TABLE_REPLACE, (String )in.readObject()); 105 setProperty(DEPLOY_STARTUP_JAVA, (String )in.readObject()); 106 setProperty(DEPLOY_STARTUP_RUN, (String )in.readObject()); 107 setProperty(ARCHIVE_PROPERTIES, (String )in.readObject()); 108 setProperty(AUTO_DEPLOY_FILE, (String )in.readObject()); 109 try { 110 nodeProps = (Hashtable )in.readObject(); 111 } catch (OptionalDataException e) { 112 if (nodeProps == null) 113 nodeProps = new Hashtable (); 114 } 115 setProperty(NAME_WORKING_DIR, (String )in.readObject()); 116 setProperty(NAME_AUTO_PACK, (String )in.readObject()); 117 setProperty(NAME_LIBRARIES, (String )in.readObject()); 118 setProperty(NAME_GENTO, (String )in.readObject()); 119 setProperty(DODS_PROJECT_JAVA_PATH, (String )in.readObject()); 120 } 121 122 public void setProperty(String key, String value) 123 { 124 putProperty(key, value, true); 125 } 126 127 public String propertyValue(String key) 128 { 129 return (String )getProperty(key); 130 } 131 132 public void setNodeProperty(String key, String prop) 133 { 134 if (nodeProps == null) 135 nodeProps = new Hashtable (); 136 137 if (prop != null) 138 try { 139 nodeProps.put(key, prop); 140 }catch (NullPointerException e) { 141 System.err.println(e); 142 } 143 else 144 nodeProps.remove(key); 145 } 146 147 public String getNodeProperty(String key) 148 { 149 if (nodeProps != null) 150 { 151 String res = (String )nodeProps.get(key); 152 return res; 153 } 154 155 return null; 156 } 157 158 159 public String getDeployRoot() 160 { 161 return propertyValue(DEPLOY_PATH_ROOT); 162 } 163 164 public void setDeployRoot(String root) 165 { 166 setProperty(DEPLOY_PATH_ROOT, root); 167 } 168 169 public boolean isGlobal() 170 { 171 return false; 172 } 173 } 174 | Popular Tags |