Source Code Cross Referenced for Win_RegistryHandler.java in  » Installer » IzPack » com » izforge » izpack » util » os » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Installer » IzPack » com.izforge.izpack.util.os 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: Win_RegistryHandler.java 2062 2008-02-25 20:22:45Z jponge $
003:         * IzPack - Copyright 2001-2008 Julien Ponge, All Rights Reserved.
004:         * 
005:         * http://izpack.org/
006:         * http://izpack.codehaus.org/
007:         * 
008:         * Copyright 2005 Klaus Bartz
009:         * 
010:         * Licensed under the Apache License, Version 2.0 (the "License");
011:         * you may not use this file except in compliance with the License.
012:         * You may obtain a copy of the License at
013:         * 
014:         *     http://www.apache.org/licenses/LICENSE-2.0
015:         *     
016:         * Unless required by applicable law or agreed to in writing, software
017:         * distributed under the License is distributed on an "AS IS" BASIS,
018:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
019:         * See the License for the specific language governing permissions and
020:         * limitations under the License.
021:         */
022:
023:        package com.izforge.izpack.util.os;
024:
025:        import java.util.List;
026:
027:        import com.coi.tools.os.izpack.Registry;
028:        import com.coi.tools.os.win.NativeLibException;
029:        import com.coi.tools.os.win.RegDataContainer;
030:
031:        /**
032:         * This is the Microsoft Windows specific implementation of <code>RegistryHandler</code>.
033:         * 
034:         * @author bartzkau
035:         * 
036:         */
037:        public class Win_RegistryHandler extends RegistryHandler {
038:
039:            Registry regWorker = null;
040:
041:            /**
042:             * Default constructor.
043:             */
044:            public Win_RegistryHandler() {
045:                super ("com.coi.tools.os.izpack.Registry");
046:                if (good())
047:                    regWorker = (Registry) worker;
048:            }
049:
050:            /**
051:             * Sets the given contents to the given registry value. If a sub key or the registry value does
052:             * not exist, it will be created. The return value is a String array which contains the names of
053:             * the keys and values which are created. REG_SZ is used as registry value type.
054:             * 
055:             * @param key the registry key which should be used or created
056:             * @param value the registry value into which the contents should be set
057:             * @param contents the contents for the value
058:             * @throws NativeLibException
059:             * @throws NativeLibException
060:             */
061:            public void setValue(String key, String value, String contents)
062:                    throws NativeLibException {
063:                if (!good())
064:                    return;
065:                regWorker.setValue(key, value, contents);
066:            }
067:
068:            /**
069:             * Sets the given contents to the given registry value. If a sub key or the registry value does
070:             * not exist, it will be created. The return value is a String array which contains the names of
071:             * the keys and values which are created. REG_MULTI_SZ is used as registry value type.
072:             * 
073:             * @param key the registry key which should be used or created
074:             * @param value the registry value into which the contents should be set
075:             * @param contents the contents for the value
076:             * @throws NativeLibException
077:             */
078:            public void setValue(String key, String value, String[] contents)
079:                    throws NativeLibException {
080:                if (!good())
081:                    return;
082:                regWorker.setValue(key, value, contents);
083:            }
084:
085:            /**
086:             * Sets the given contents to the given registry value. If a sub key or the registry value does
087:             * not exist, it will be created. The return value is a String array which contains the names of
088:             * the keys and values which are created. REG_BINARY is used as registry value type.
089:             * 
090:             * @param key the registry key which should be used or created
091:             * @param value the registry value into which the contents should be set
092:             * @param contents the contents for the value
093:             * @throws NativeLibException
094:             */
095:            public void setValue(String key, String value, byte[] contents)
096:                    throws NativeLibException {
097:                if (!good())
098:                    return;
099:                regWorker.setValue(key, value, contents);
100:            }
101:
102:            /**
103:             * Sets the given contents to the given registry value. If a sub key or the registry value does
104:             * not exist, it will be created. The return value is a String array which contains the names of
105:             * the keys and values which are created. REG_DWORD is used as registry value type.
106:             * 
107:             * @param key the registry key which should be used or created
108:             * @param value the registry value into which the contents should be set
109:             * @param contents the contents for the value
110:             * @throws NativeLibException
111:             */
112:            public void setValue(String key, String value, long contents)
113:                    throws NativeLibException {
114:                if (!good())
115:                    return;
116:                regWorker.setValue(key, value, contents);
117:            }
118:
119:            /**
120:             * Returns the contents of the key/value pair if value exist, else the given default value.
121:             * 
122:             * @param key the registry key which should be used
123:             * @param value the registry value from which the contents should be requested
124:             * @param defaultVal value to be used if no value exist in the registry
125:             * @return requested value if exist, else the default value
126:             * @throws NativeLibException
127:             */
128:            public RegDataContainer getValue(String key, String value,
129:                    RegDataContainer defaultVal) throws NativeLibException {
130:                if (!good())
131:                    return (null);
132:                if (valueExist(key, value))
133:                    return (getValue(key, value));
134:                return (defaultVal);
135:            }
136:
137:            /**
138:             * Returns whether a key exist or not.
139:             * 
140:             * @param key key to be evaluated
141:             * @return whether a key exist or not
142:             * @throws NativeLibException
143:             */
144:            public boolean keyExist(String key) throws NativeLibException {
145:                if (!good())
146:                    return (false);
147:                return (regWorker.keyExist(key));
148:            }
149:
150:            /**
151:             * Returns whether a the given value under the given key exist or not.
152:             * 
153:             * @param key key to be used as path for the value
154:             * @param value value name to be evaluated
155:             * @return whether a the given value under the given key exist or not
156:             * @throws NativeLibException
157:             */
158:            public boolean valueExist(String key, String value)
159:                    throws NativeLibException {
160:                if (!good())
161:                    return (false);
162:                return (regWorker.valueExist(key, value));
163:            }
164:
165:            /**
166:             * Returns all keys which are defined under the given key.
167:             * 
168:             * @param key key to be used as path for the sub keys
169:             * @return all keys which are defined under the given key
170:             * @throws NativeLibException
171:             */
172:            public String[] getSubkeys(String key) throws NativeLibException {
173:                if (!good())
174:                    return (null);
175:                return (regWorker.getSubkeys(key));
176:            }
177:
178:            /**
179:             * Returns all value names which are defined under the given key.
180:             * 
181:             * @param key key to be used as path for the value names
182:             * @return all value names which are defined under the given key
183:             * @throws NativeLibException
184:             */
185:            public String[] getValueNames(String key) throws NativeLibException {
186:                if (!good())
187:                    return (null);
188:                return (regWorker.getValueNames(key));
189:            }
190:
191:            /**
192:             * Returns the contents of the key/value pair if value exist, else an exception is raised.
193:             * 
194:             * @param key the registry key which should be used
195:             * @param value the registry value from which the contents should be requested
196:             * @return requested value if exist, else an exception
197:             * @throws NativeLibException
198:             */
199:            public RegDataContainer getValue(String key, String value)
200:                    throws NativeLibException {
201:                if (!good())
202:                    return (null);
203:                return (regWorker.getValue(key, value));
204:            }
205:
206:            /**
207:             * Creates the given key in the registry.
208:             * 
209:             * @param key key to be created
210:             * @throws NativeLibException
211:             */
212:            public void createKey(String key) throws NativeLibException {
213:                if (!good())
214:                    return;
215:                regWorker.createKey(key);
216:            }
217:
218:            /**
219:             * Deletes the given key if exist, else throws an exception.
220:             * @param key key to be deleted
221:             * @throws NativeLibException
222:             */
223:            public void deleteKey(String key) throws NativeLibException {
224:                if (!good())
225:                    return;
226:                regWorker.deleteKey(key);
227:            }
228:
229:            /**
230:             * Deletes a key under the current root if it is empty, else do nothing.
231:             * 
232:             * @param key key to be deleted
233:             * @throws NativeLibException
234:             */
235:            public void deleteKeyIfEmpty(String key) throws NativeLibException {
236:                if (!good())
237:                    return;
238:                regWorker.deleteKeyIfEmpty(key);
239:            }
240:
241:            /**
242:             * Deletes a value.
243:             * 
244:             * @param key key of the value which should be deleted
245:             * @param value value name to be deleted
246:             * @throws NativeLibException
247:             */
248:            public void deleteValue(String key, String value)
249:                    throws NativeLibException {
250:                if (!good())
251:                    return;
252:                regWorker.deleteValue(key, value);
253:            }
254:
255:            /**
256:             * Sets the root for the next registry access.
257:             * 
258:             * @param i an integer which refers to a HKEY
259:             * @throws NativeLibException
260:             */
261:            public void setRoot(int i) throws NativeLibException {
262:                if (!good())
263:                    return;
264:                regWorker.setRoot(i);
265:            }
266:
267:            /**
268:             * Return the root as integer (HKEY_xxx).
269:             * 
270:             * @return the root as integer
271:             * @throws NativeLibException
272:             */
273:            public int getRoot() throws NativeLibException {
274:                if (!good())
275:                    return (0);
276:                return (regWorker.getRoot());
277:            }
278:
279:            /**
280:             * Activates logging of registry changes.
281:             * 
282:             * @throws NativeLibException
283:             */
284:            public void activateLogging() throws NativeLibException {
285:                if (!good())
286:                    return;
287:                regWorker.activateLogging();
288:            }
289:
290:            /**
291:             * Suspends logging of registry changes.
292:             * 
293:             * @throws NativeLibException
294:             */
295:            public void suspendLogging() throws NativeLibException {
296:                if (!good())
297:                    return;
298:                regWorker.suspendLogging();
299:            }
300:
301:            /**
302:             * Resets logging of registry changes.
303:             * 
304:             * @throws NativeLibException
305:             */
306:            public void resetLogging() throws NativeLibException {
307:                if (!good())
308:                    return;
309:                regWorker.resetLogging();
310:            }
311:
312:            public List<Object> getLoggingInfo() throws NativeLibException {
313:                if (!good())
314:                    return (null);
315:                return (regWorker.getLoggingInfo());
316:            }
317:
318:            public void setLoggingInfo(List info) throws NativeLibException {
319:                if (!good())
320:                    return;
321:                regWorker.setLoggingInfo(info);
322:            }
323:
324:            public void addLoggingInfo(List info) throws NativeLibException {
325:                if (!good())
326:                    return;
327:                regWorker.addLoggingInfo(info);
328:            }
329:
330:            public void rewind() throws NativeLibException {
331:                if (!good())
332:                    return;
333:                regWorker.rewind();
334:            }
335:
336:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.