KickJava   Java API By Example, From Geeks To Geeks.

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


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 DeploySettings 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 (DeploySettings.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 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 JavaDoc {
90         setProperty(DEPLOY_CONTENT_TYPES, (String JavaDoc)in.readObject());
91         setProperty(DEPLOY_CONTENT_ENABLE, (String JavaDoc)in.readObject());
92         setProperty(DEPLOY_TYPE, (String JavaDoc)in.readObject());
93         setProperty(DEPLOY_BUILD, (String JavaDoc)in.readObject());
94         setProperty(DEPLOY_ECHO, (String JavaDoc)in.readObject());
95         setProperty(DEPLOY_OVERWRITE, (String JavaDoc)in.readObject());
96         setProperty(DEPLOY_PATH_ROOT, (String JavaDoc)in.readObject());
97         setProperty(DEPLOY_PATH_BOOTSTRAP, (String JavaDoc)in.readObject());
98         setProperty(DEPLOY_INPUT_FILTER, (String JavaDoc)in.readObject());
99         setProperty(DEPLOY_INPUT_ENABLE, (String JavaDoc)in.readObject());
100         setProperty(DEPLOY_PATH_INPUT, (String JavaDoc)in.readObject());
101         setProperty(DEPLOY_PATH_RESOURCE, (String JavaDoc)in.readObject());
102         setProperty(DEPLOY_TABLE_LENGTH, (String JavaDoc)in.readObject());
103         setProperty(DEPLOY_TABLE_FIND, (String JavaDoc)in.readObject());
104         setProperty(DEPLOY_TABLE_REPLACE, (String JavaDoc)in.readObject());
105         setProperty(DEPLOY_STARTUP_JAVA, (String JavaDoc)in.readObject());
106         setProperty(DEPLOY_STARTUP_RUN, (String JavaDoc)in.readObject());
107         setProperty(ARCHIVE_PROPERTIES, (String JavaDoc)in.readObject());
108         setProperty(AUTO_DEPLOY_FILE, (String JavaDoc)in.readObject());
109         try {
110             nodeProps = (Hashtable JavaDoc)in.readObject();
111         } catch (OptionalDataException e) {
112             if (nodeProps == null)
113                 nodeProps = new Hashtable JavaDoc();
114         }
115         setProperty(NAME_WORKING_DIR, (String JavaDoc)in.readObject());
116         setProperty(NAME_AUTO_PACK, (String JavaDoc)in.readObject());
117         setProperty(NAME_LIBRARIES, (String JavaDoc)in.readObject());
118         setProperty(NAME_GENTO, (String JavaDoc)in.readObject());
119         setProperty(DODS_PROJECT_JAVA_PATH, (String JavaDoc)in.readObject());
120     }
121
122     public void setProperty(String JavaDoc key, String JavaDoc value)
123     {
124         putProperty(key, value, true);
125     }
126
127     public String JavaDoc propertyValue(String JavaDoc key)
128     {
129         return (String JavaDoc)getProperty(key);
130     }
131
132     public void setNodeProperty(String JavaDoc key, String JavaDoc prop)
133     {
134         if (nodeProps == null)
135             nodeProps = new Hashtable JavaDoc();
136
137         if (prop != null)
138             try {
139                 nodeProps.put(key, prop);
140             }catch (NullPointerException JavaDoc e) {
141                 System.err.println(e);
142             }
143         else
144             nodeProps.remove(key);
145     }
146
147     public String JavaDoc getNodeProperty(String JavaDoc key)
148     {
149         if (nodeProps != null)
150         {
151             String JavaDoc res = (String JavaDoc)nodeProps.get(key);
152             return res;
153         }
154
155         return null;
156     }
157
158
159     public String JavaDoc getDeployRoot()
160     {
161         return propertyValue(DEPLOY_PATH_ROOT);
162     }
163
164     public void setDeployRoot(String JavaDoc root)
165     {
166         setProperty(DEPLOY_PATH_ROOT, root);
167     }
168
169     public boolean isGlobal()
170     {
171         return false;
172     }
173 }
174
Popular Tags