Source Code Cross Referenced for SlideConfigurationAdapter.java in  » Content-Management-System » apache-lenya-2.0 » org » apache » cocoon » components » slide » impl » 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 » Content Management System » apache lenya 2.0 » org.apache.cocoon.components.slide.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:
018:        package org.apache.cocoon.components.slide.impl;
019:
020:        import java.util.Enumeration;
021:        import java.util.Vector;
022:
023:        import org.apache.slide.util.conf.Configuration;
024:        import org.apache.slide.util.conf.ConfigurationException;
025:
026:        /**
027:         * The class represent an adapter for the configuration class from jakarta slide
028:         *
029:         * @version CVS $Id: SlideConfigurationAdapter.java 433543 2006-08-22 06:22:54Z crossley $
030:         */
031:        public class SlideConfigurationAdapter implements  Configuration {
032:
033:            private org.apache.avalon.framework.configuration.Configuration configuration;
034:
035:            /**
036:             * Create a new adapter to map a Avalon configuration 
037:             * to a Slide configuration 
038:             *
039:             * @param configuration Avalon configuration
040:             */
041:            public SlideConfigurationAdapter(
042:                    org.apache.avalon.framework.configuration.Configuration configuration) {
043:                this .configuration = configuration;
044:            }
045:
046:            /**
047:             * Return the name of the node.
048:             *
049:             * @return name of the <code>Configuration</code> node.
050:             */
051:            public String getName() {
052:                return this .configuration.getName();
053:            }
054:
055:            /**
056:             * Return a new <code>Configuration</code> instance encapsulating the
057:             * specified child node.
058:             *
059:             * @param child The name of the child node.
060:             *
061:             * @return Configuration
062:             *
063:             * @throws ConfigurationException If no child with that name exists.
064:             */
065:            public Configuration getConfiguration(String child)
066:                    throws ConfigurationException {
067:                if (this .configuration.getChild(child, false) == null)
068:                    throw new ConfigurationException(
069:                            "No configuration element " + child + " at "
070:                                    + this .configuration.getLocation(), this );
071:                return new SlideConfigurationAdapter(this .configuration
072:                        .getChild(child));
073:            }
074:
075:            /**
076:             * Return an <code>Enumeration</code> of <code>Configuration<code>
077:             * elements containing all node children with the specified name.
078:             *
079:             * @param name The name of the children to get.
080:             *
081:             * @return Enumeration.  The <code>Enumeration</code> will be
082:             *         empty if there are no nodes by the specified name.
083:             */
084:            public Enumeration getConfigurations(String name) {
085:
086:                Vector configurations = new Vector();
087:                org.apache.avalon.framework.configuration.Configuration[] childs = this .configuration
088:                        .getChildren(name);
089:
090:                for (int i = 0; i < childs.length; i++) {
091:                    configurations.addElement(new SlideConfigurationAdapter(
092:                            childs[i]));
093:                }
094:                return configurations.elements();
095:            }
096:
097:            /**
098:             * Return the value of specified attribute.
099:             *
100:             * @param paramName The name of the parameter you ask the value of.
101:             *
102:             * @return String value of attribute.
103:             *
104:             * @throws ConfigurationException If no attribute with that name exists.
105:             */
106:            public String getAttribute(String paramName)
107:                    throws ConfigurationException {
108:
109:                try {
110:                    return this .configuration.getAttribute(paramName);
111:                } catch (org.apache.avalon.framework.configuration.ConfigurationException ce) {
112:                    throw new ConfigurationException(ce.getMessage(), this );
113:                }
114:            }
115:
116:            /**
117:             * Return the <code>int</code> value of the specified attribute contained
118:             * in this node.
119:             *
120:             * @param paramName The name of the parameter you ask the value of.
121:             *
122:             * @return int value of attribute
123:             *
124:             * @throws ConfigurationException If no parameter with that name exists.
125:             *                                or if conversion to <code>int</code> fails.
126:             */
127:            public int getAttributeAsInt(String paramName)
128:                    throws ConfigurationException {
129:
130:                try {
131:                    return this .configuration.getAttributeAsInteger(paramName);
132:                } catch (org.apache.avalon.framework.configuration.ConfigurationException ce) {
133:                    throw new ConfigurationException(ce.getMessage(), this );
134:                }
135:            }
136:
137:            /**
138:             * Returns the value of the attribute specified by its name as a
139:             * <code>long</code>.
140:             *
141:             *
142:             * @param name       
143:             *
144:             * @return long value of attribute
145:             *
146:             * @throws ConfigurationException If no parameter with that name exists.
147:             *                                or if conversion to <code>long</code> fails.
148:             */
149:            public long getAttributeAsLong(String name)
150:                    throws ConfigurationException {
151:
152:                try {
153:                    return this .configuration.getAttributeAsLong(name);
154:                } catch (org.apache.avalon.framework.configuration.ConfigurationException ce) {
155:                    throw new ConfigurationException(ce.getMessage(), this );
156:                }
157:            }
158:
159:            /**
160:             * Return the <code>float</code> value of the specified parameter contained
161:             * in this node.
162:             *
163:             * @param paramName The name of the parameter you ask the value of.
164:             *
165:             * @return float value of attribute
166:             *
167:             * @throws ConfigurationException If no parameter with that name exists.
168:             *                                or if conversion to <code>float</code> fails.
169:             */
170:            public float getAttributeAsFloat(String paramName)
171:                    throws ConfigurationException {
172:
173:                try {
174:                    return this .configuration.getAttributeAsFloat(paramName);
175:                } catch (org.apache.avalon.framework.configuration.ConfigurationException ce) {
176:                    throw new ConfigurationException(ce.getMessage(), this );
177:                }
178:            }
179:
180:            /**
181:             * Return the <code>boolean</code> value of the specified parameter contained
182:             * in this node.<br>
183:             *
184:             * @param paramName The name of the parameter you ask the value of.
185:             *
186:             * @return boolean value of attribute
187:             *
188:             * @throws ConfigurationException If no parameter with that name exists.
189:             *                                   or if conversion to <code>boolean</code> fails.
190:             */
191:            public boolean getAttributeAsBoolean(String paramName)
192:                    throws ConfigurationException {
193:
194:                try {
195:                    return this .configuration.getAttributeAsBoolean(paramName);
196:                } catch (org.apache.avalon.framework.configuration.ConfigurationException ce) {
197:                    throw new ConfigurationException(ce.getMessage(), this );
198:                }
199:            }
200:
201:            /**
202:             * Return the <code>String</code> value of the node.
203:             *
204:             * @return the value of the node.
205:             */
206:            public String getValue() {
207:
208:                try {
209:                    return this .configuration.getValue();
210:                } catch (org.apache.avalon.framework.configuration.ConfigurationException ce) {
211:                    return "";
212:                }
213:            }
214:
215:            /**
216:             * Return the <code>int</code> value of the node.
217:             *
218:             * @return the value of the node.
219:             *
220:             * @throws ConfigurationException If conversion to <code>int</code> fails.
221:             */
222:            public int getValueAsInt() throws ConfigurationException {
223:
224:                try {
225:                    return this .configuration.getValueAsInteger();
226:                } catch (org.apache.avalon.framework.configuration.ConfigurationException ce) {
227:                    throw new ConfigurationException(ce.getMessage(), this );
228:                }
229:            }
230:
231:            /**
232:             * Return the <code>float</code> value of the node.
233:             *
234:             * @return the value of the node.
235:             *
236:             * @throws ConfigurationException If conversion to <code>float</code> fails.
237:             */
238:            public float getValueAsFloat() throws ConfigurationException {
239:
240:                try {
241:                    return this .configuration.getValueAsFloat();
242:                } catch (org.apache.avalon.framework.configuration.ConfigurationException ce) {
243:                    throw new ConfigurationException(ce.getMessage(), this );
244:                }
245:            }
246:
247:            /**
248:             * Return the <code>boolean</code> value of the node.
249:             *
250:             * @return the value of the node.
251:             *
252:             * @throws ConfigurationException If conversion to <code>boolean</code> fails.
253:             */
254:            public boolean getValueAsBoolean() throws ConfigurationException {
255:
256:                try {
257:                    return this .configuration.getValueAsBoolean();
258:                } catch (org.apache.avalon.framework.configuration.ConfigurationException ce) {
259:                    throw new ConfigurationException(ce.getMessage(), this );
260:                }
261:            }
262:
263:            /**
264:             * Return the <code>long</code> value of the node.<br>
265:             *
266:             * @return the value of the node.
267:             *
268:             * @throws ConfigurationException If conversion to <code>long</code> fails.
269:             */
270:            public long getValueAsLong() throws ConfigurationException {
271:
272:                try {
273:                    return this .configuration.getValueAsLong();
274:                } catch (org.apache.avalon.framework.configuration.ConfigurationException ce) {
275:                    throw new ConfigurationException(ce.getMessage(), this );
276:                }
277:            }
278:
279:            /**
280:             * Returns the value of the configuration element as a <code>String</code>.
281:             * If the configuration value is not set, the default value will be
282:             * used.
283:             *
284:             * @param defaultValue The default value desired.
285:             *
286:             * @return String value of the <code>Configuration</code>, or default
287:             *         if none specified.
288:             */
289:            public String getValue(String defaultValue) {
290:
291:                return this .configuration.getValue(defaultValue);
292:            }
293:
294:            /**
295:             * Returns the value of the configuration element as an <code>int</code>.
296:             * If the configuration value is not set, the default value will be
297:             * used.
298:             *
299:             * @param defaultValue The default value desired.
300:             *
301:             * @return int value of the <code>Configuration</code>, or default
302:             *         if none specified.
303:             */
304:            public int getValueAsInt(int defaultValue) {
305:
306:                return this .configuration.getValueAsInteger(defaultValue);
307:            }
308:
309:            /**
310:             * Returns the value of the configuration element as a <code>long</code>.
311:             * If the configuration value is not set, the default value will be
312:             * used.
313:             *
314:             * @param defaultValue The default value desired.
315:             *
316:             * @return long value of the <code>Configuration</code>, or default
317:             *         if none specified.
318:             */
319:            public long getValueAsLong(long defaultValue) {
320:
321:                return this .configuration.getValueAsLong(defaultValue);
322:            }
323:
324:            /**
325:             * Returns the value of the configuration element as a <code>float</code>.
326:             * If the configuration value is not set, the default value will be
327:             * used.
328:             *
329:             * @param defaultValue The default value desired.
330:             *
331:             * @return float value of the <code>Configuration</code>, or default
332:             *         if none specified.
333:             */
334:            public float getValueAsFloat(float defaultValue) {
335:
336:                return this .configuration.getValueAsFloat(defaultValue);
337:            }
338:
339:            /**
340:             * Returns the value of the configuration element as a <code>boolean</code>.
341:             * If the configuration value is not set, the default value will be
342:             * used.
343:             *
344:             * @param defaultValue The default value desired.
345:             *
346:             * @return boolean value of the <code>Configuration</code>, or default
347:             *         if none specified.
348:             */
349:            public boolean getValueAsBoolean(boolean defaultValue) {
350:
351:                return this .configuration.getValueAsBoolean(defaultValue);
352:            }
353:
354:            /**
355:             * Returns the value of the attribute specified by its name as a
356:             * <code>String</code>, or the default value if no attribute by
357:             * that name exists or is empty.
358:             *
359:             * @param name The name of the attribute you ask the value of.
360:             * @param defaultValue The default value desired.
361:             *
362:             * @return String value of attribute. It will return the default
363:             *         value if the named attribute does not exist, or if
364:             *         the value is not set.
365:             */
366:            public String getAttribute(String name, String defaultValue) {
367:
368:                return this .configuration.getAttribute(name, defaultValue);
369:            }
370:
371:            /**
372:             * Returns the value of the attribute specified by its name as a
373:             * <code>int</code>, or the default value if no attribute by
374:             * that name exists or is empty.
375:             *
376:             * @param name The name of the attribute you ask the value of.
377:             * @param defaultValue The default value desired.
378:             *
379:             * @return int value of attribute. It will return the default
380:             *         value if the named attribute does not exist, or if
381:             *         the value is not set.
382:             */
383:            public int getAttributeAsInt(String name, int defaultValue) {
384:
385:                return this .configuration.getAttributeAsInteger(name,
386:                        defaultValue);
387:            }
388:
389:            /**
390:             * Returns the value of the attribute specified by its name as a
391:             * <code>long</code>, or the default value if no attribute by
392:             * that name exists or is empty.
393:             *
394:             * @param name The name of the attribute you ask the value of.
395:             * @param defaultValue The default value desired.
396:             *
397:             * @return long value of attribute. It will return the default
398:             *         value if the named attribute does not exist, or if
399:             *         the value is not set.
400:             */
401:            public long getAttributeAsLong(String name, long defaultValue) {
402:
403:                return this .configuration
404:                        .getAttributeAsLong(name, defaultValue);
405:            }
406:
407:            /**
408:             * Returns the value of the attribute specified by its name as a
409:             * <code>float</code>, or the default value if no attribute by
410:             * that name exists or is empty.
411:             *
412:             * @param name The name of the attribute you ask the value of.
413:             * @param defaultValue The default value desired.
414:             *
415:             * @return float value of attribute. It will return the default
416:             *         value if the named attribute does not exist, or if
417:             *         the value is not set.
418:             */
419:            public float getAttributeAsFloat(String name, float defaultValue) {
420:
421:                return this .configuration.getAttributeAsFloat(name,
422:                        defaultValue);
423:            }
424:
425:            /**
426:             * Returns the value of the attribute specified by its name as a
427:             * <code>boolean</code>, or the default value if no attribute by
428:             * that name exists or is empty.
429:             *
430:             * @param name The name of the attribute you ask the value of.
431:             * @param defaultValue The default value desired.
432:             *
433:             * @return boolean value of attribute. It will return the default
434:             *         value if the named attribute does not exist, or if
435:             *         the value is not set.
436:             */
437:            public boolean getAttributeAsBoolean(String name,
438:                    boolean defaultValue) {
439:
440:                return this .configuration.getAttributeAsBoolean(name,
441:                        defaultValue);
442:            }
443:
444:            /**
445:             * Return a <code>String</code> indicating the position of this
446:             * configuration element in a source file or URI.
447:             *
448:             * @return String if a source file or URI is specified.  Otherwise
449:             *         it returns <code>null</code>
450:             */
451:            public String getLocation() {
452:
453:                return this.configuration.getLocation();
454:            }
455:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.