KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > kelp > forte > DodsSettings


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  * Lisa Reese
21  *
22  */

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 JavaDoc;
34 import java.io.*;
35 /** Options for something or other.
36  *
37  * @author rees0234
38  */

39 public class DodsSettings extends SystemOption implements PropertyKeys{
40
41     static final long serialVersionUID = 8806955980938332585L;
42
43     protected Hashtable JavaDoc nodeProps = null;
44
45     public String JavaDoc displayName () {
46         return NbBundle.getMessage (DodsSettings.class, "LBL_deploy_settings");
47     }
48
49     public HelpCtx getHelpCtx () {
50         return HelpCtx.DEFAULT_HELP;
51         // If you provide context help then use:
52
// return new HelpCtx (DeploySettings.class);
53
}
54
55     /** Default instance of this system option, for the convenience of associated classes. */
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 JavaDoc {
69         setProperty("DodsParameters", (String JavaDoc)in.readObject());
70         setProperty("DomlFilepath", (String JavaDoc)in.readObject());
71         setProperty("enhydra.dods.java.project.path", (String JavaDoc)in.readObject());
72         setProperty("DodsEnhydraPath", (String JavaDoc)in.readObject());
73
74     }
75
76     public void setProperty(String JavaDoc key, String JavaDoc value)
77     {
78         putProperty(key, value, true);
79     }
80
81     public String JavaDoc propertyValue(String JavaDoc key)
82     {
83         return (String JavaDoc)getProperty(key);
84     }
85
86     public void setNodeProperty(String JavaDoc key, String JavaDoc prop)
87     {
88         if (nodeProps == null)
89             nodeProps = new Hashtable JavaDoc();
90
91         if (prop != null)
92             try {
93                 nodeProps.put(key, prop);
94             }catch (NullPointerException JavaDoc e) {
95                 System.err.println(e);
96             }
97         else
98             nodeProps.remove(key);
99     }
100
101     public String JavaDoc getNodeProperty(String JavaDoc key)
102     {
103         if (nodeProps != null)
104         {
105             String JavaDoc res = (String JavaDoc)nodeProps.get(key);
106             return res;
107         }
108
109         return null;
110     }
111
112     public String JavaDoc getDeployRoot()
113     {
114         return propertyValue(DEPLOY_PATH_ROOT);
115     }
116
117     public void setDeployRoot(String JavaDoc 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