1 package org.apache.velocity.runtime;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.File;
23 import java.io.IOException;
24 import java.io.InputStream;
25 import java.io.Reader;
26 import java.util.Enumeration;
27 import java.util.HashMap;
28 import java.util.Hashtable;
29 import java.util.Map;
30 import java.util.Properties;
31
32 import org.apache.commons.collections.ExtendedProperties;
33 import org.apache.velocity.Template;
34 import org.apache.velocity.app.event.EventCartridge;
35 import org.apache.velocity.app.event.EventHandler;
36 import org.apache.velocity.app.event.IncludeEventHandler;
37 import org.apache.velocity.app.event.InvalidReferenceEventHandler;
38 import org.apache.velocity.app.event.MethodExceptionEventHandler;
39 import org.apache.velocity.app.event.NullSetEventHandler;
40 import org.apache.velocity.app.event.ReferenceInsertionEventHandler;
41 import org.apache.velocity.exception.ParseErrorException;
42 import org.apache.velocity.exception.ResourceNotFoundException;
43 import org.apache.velocity.runtime.directive.Directive;
44 import org.apache.velocity.runtime.log.Log;
45 import org.apache.velocity.runtime.log.LogManager;
46 import org.apache.velocity.runtime.parser.ParseException;
47 import org.apache.velocity.runtime.parser.Parser;
48 import org.apache.velocity.runtime.parser.node.SimpleNode;
49 import org.apache.velocity.runtime.resource.ContentResource;
50 import org.apache.velocity.runtime.resource.ResourceManager;
51 import org.apache.velocity.util.ClassUtils;
52 import org.apache.velocity.util.RuntimeServicesAware;
53 import org.apache.velocity.util.StringUtils;
54 import org.apache.velocity.util.introspection.Introspector;
55 import org.apache.velocity.util.introspection.Uberspect;
56 import org.apache.velocity.util.introspection.UberspectLoggable;
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105 public class RuntimeInstance implements RuntimeConstants, RuntimeServices
106 {
107
108
109
110 private VelocimacroFactory vmFactory = null;
111
112
113
114
115
116
117
118 private Log log = new Log();
119
120
121
122
123 private ParserPool parserPool;
124
125
126
127
128 private boolean initializing = false;
129
130
131
132
133 private boolean initialized = false;
134
135
136
137
138
139 private ExtendedProperties overridingProperties = null;
140
141
142
143
144
145
146
147
148 private Hashtable runtimeDirectives;
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164 private ExtendedProperties configuration = new ExtendedProperties();
165
166 private ResourceManager resourceManager = null;
167
168
169
170
171
172 private EventCartridge eventCartridge = null;
173
174
175
176
177
178 private Introspector introspector = null;
179
180
181
182
183
184
185
186 private Map applicationAttributes = null;
187
188
189 private Uberspect uberSpect;
190
191
192
193
194 public RuntimeInstance()
195 {
196
197
198
199 vmFactory = new VelocimacroFactory( this );
200
201
202
203
204 introspector = new Introspector(getLog());
205
206
207
208
209 applicationAttributes = new HashMap();
210 }
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228 public synchronized void init()
229 throws Exception
230 {
231 if (!initialized && !initializing)
232 {
233 initializing = true;
234
235 log.trace("*******************************************************************");
236 log.debug("Starting Apache Velocity v@build.version@ (compiled: @build.time@)");
237 log.trace("RuntimeInstance initializing.");
238
239 initializeProperties();
240 initializeLog();
241 initializeResourceManager();
242 initializeDirectives();
243 initializeEventHandlers();
244 initializeParserPool();
245
246 initializeIntrospection();
247
248
249
250
251 vmFactory.initVelocimacro();
252
253 log.trace("RuntimeInstance successfully initialized.");
254
255 initialized = true;
256 initializing = false;
257 }
258 }
259
260
261
262
263
264 public boolean isInitialized()
265 {
266 return initialized;
267 }
268
269
270
271
272
273 private void initializeIntrospection()
274 throws Exception
275 {
276 String rm = getString(RuntimeConstants.UBERSPECT_CLASSNAME);
277
278 if (rm != null && rm.length() > 0)
279 {
280 Object o = null;
281
282 try
283 {
284 o = ClassUtils.getNewInstance( rm );
285 }
286 catch (ClassNotFoundException cnfe)
287 {
288 String err = "The specified class for Uberspect (" + rm
289 + ") does not exist or is not accessible to the current classloader.";
290 log.error(err);
291 throw new Exception(err);
292 }
293
294 if (!(o instanceof Uberspect))
295 {
296 String err = "The specified class for Uberspect ("
297 + rm + ") does not implement " + Uberspect.class.getName()
298 + "; Velocity is not initialized correctly.";
299
300 log.error(err);
301 throw new Exception(err);
302 }
303
304 uberSpect = (Uberspect) o;
305
306 if (uberSpect instanceof UberspectLoggable)
307 {
308 ((UberspectLoggable) uberSpect).setLog(getLog());
309 }
310
311 if (uberSpect instanceof RuntimeServicesAware)
312 {
313 ((RuntimeServicesAware) uberSpect).setRuntimeServices(this);
314 }
315
316 uberSpect.init();
317 }
318 else
319 {
320
321
322
323
324 String err = "It appears that no class was specified as the"
325 + " Uberspect. Please ensure that all configuration"
326 + " information is correct.";
327
328 log.error(err);
329 throw new Exception(err);
330 }
331 }
332
333
334
335
336
337
338 private void setDefaultProperties()
339 {
340 InputStream inputStream = null;
341 try
342 {
343 inputStream = getClass()
344 .getResourceAsStream('/' + DEFAULT_RUNTIME_PROPERTIES);
345
346 configuration.load( inputStream );
347
348 if (log.isDebugEnabled())
349 {
350 log.debug("Default Properties File: " +
351 new File(DEFAULT_RUNTIME_PROPERTIES).getPath());
352 }
353
354
355 }
356 catch (IOException ioe)
357 {
358 log.error("Cannot get Velocity Runtime default properties!", ioe);
359 }
360 finally
361 {
362 try
363 {
364 if (inputStream != null)
365 {
366 inputStream.close();
367 }
368 }
369 catch (IOException ioe)
370 {
371 log.error("Cannot close Velocity Runtime default properties!", ioe);
372 }
373 }
374 }
375
376
377
378
379
380
381
382
383 public void setProperty(String key, Object value)
384 {
385 if (overridingProperties == null)
386 {
387 overridingProperties = new ExtendedProperties();
388 }
389
390 overridingProperties.setProperty(key, value);
391 }
392
393
394
395
396
397
398
399
400
401
402
403 public void setConfiguration( ExtendedProperties configuration)
404 {
405 if (overridingProperties == null)
406 {
407 overridingProperties = configuration;
408 }
409 else
410 {
411
412 if (overridingProperties != configuration)
413 {
414 overridingProperties.combine(configuration);
415 }
416 }
417 }
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438 public void addProperty(String key, Object value)
439 {
440 if (overridingProperties == null)
441 {
442 overridingProperties = new ExtendedProperties();
443 }
444
445 overridingProperties.addProperty(key, value);
446 }
447
448
449
450
451
452
453
454 public void clearProperty(String key)
455 {
456 if (overridingProperties != null)
457 {
458 overridingProperties.clearProperty(key);
459 }
460 }
461
462
463
464
465
466
467
468
469
470 public Object getProperty(String key)
471 {
472 Object o = null;
473
474
475
476
477 if (!initialized && !initializing && overridingProperties != null)
478 {
479 o = overridingProperties.get(key);
480 }
481
482
483
484
485 if (o == null)
486 {
487 o = configuration.getProperty(key);
488 }
489 if (o instanceof String)
490 {
491 return StringUtils.nullTrim((String) o);
492 }
493 else
494 {
495 return o;
496 }
497 }
498
499
500
501
502
503
504
505
506
507 private void initializeProperties()
508 {
509
510
511
512
513 if (configuration.isInitialized() == false)
514 {
515 setDefaultProperties();
516 }
517
518 if( overridingProperties != null)
519 {
520 configuration.combine(overridingProperties);
521 }
522 }
523
524
525
526
527
528
529
530
531 public void init(Properties p) throws Exception
532 {
533 overridingProperties = ExtendedProperties.convertProperties(p);
534 init();
535 }
536
537
538
539
540
541
542
543
544 public void init(String configurationFile)
545 throws Exception
546 {
547 overridingProperties = new ExtendedProperties(configurationFile);
548 init();
549 }
550
551 private void initializeResourceManager()
552 throws Exception
553 {
554
555
556
557
558 String rm = getString(RuntimeConstants.RESOURCE_MANAGER_CLASS);
559
560 if (rm != null && rm.length() > 0)
561 {
562
563
564
565
566
567
568 Object o = null;
569
570 try
571 {
572 o = ClassUtils.getNewInstance( rm );
573 }
574 catch (ClassNotFoundException cnfe )
575 {
576 String err = "The specified class for ResourceManager (" + rm
577 + ") does not exist or is not accessible to the current classloader.";
578 log.error(err);
579 throw new Exception(err);
580 }
581
582 if (!(o instanceof ResourceManager))
583 {
584 String err = "The specified class for ResourceManager (" + rm
585 + ") does not implement " + ResourceManager.class.getName()
586 + "; Velocity is not initialized correctly.";
587
588 log.error(err);
589 throw new Exception(err);
590 }
591
592 resourceManager = (ResourceManager) o;
593
594 resourceManager.initialize(this);
595 }
596 else
597 {
598
599
600
601
602 String err = "It appears that no class was specified as the"
603 + " ResourceManager. Please ensure that all configuration"
604 + " information is correct.";
605
606 log.error(err);
607 throw new Exception( err );
608 }
609 }
610
611 private void initializeEventHandlers()
612 throws Exception
613 {
614
615 eventCartridge = new EventCartridge();
616
617
618
619
620
621 String[] referenceinsertion = configuration.getStringArray(RuntimeConstants.EVENTHANDLER_REFERENCEINSERTION);
622 if ( referenceinsertion != null )
623 {
624 for ( int i=0; i < referenceinsertion.length; i++ )
625 {
626 EventHandler ev = initializeSpecificEventHandler(referenceinsertion[i],RuntimeConstants.EVENTHANDLER_REFERENCEINSERTION,ReferenceInsertionEventHandler.class);
627 if (ev != null)
628 eventCartridge.addReferenceInsertionEventHandler((ReferenceInsertionEventHandler) ev);
629 }
630 }
631
632 String[] nullset = configuration.getStringArray(RuntimeConstants.EVENTHANDLER_NULLSET);
633 if ( nullset != null )
634 {
635 for ( int i=0; i < nullset.length; i++ )
636 {
637 EventHandler ev = initializeSpecificEventHandler(nullset[i],RuntimeConstants.EVENTHANDLER_NULLSET,NullSetEventHandler.class);
638 if (ev != null)
639 eventCartridge.addNullSetEventHandler((NullSetEventHandler) ev);
640 }
641 }
642
643 String[] methodexception = configuration.getStringArray(RuntimeConstants.EVENTHANDLER_METHODEXCEPTION);
644 if ( methodexception != null )
645 {
646 for ( int i=0; i < methodexception.length; i++ )
647 {
648 EventHandler ev = initializeSpecificEventHandler(methodexception[i],RuntimeConstants.EVENTHANDLER_METHODEXCEPTION,MethodExceptionEventHandler.class);
649 if (ev != null)
650 eventCartridge.addMethodExceptionHandler((MethodExceptionEventHandler) ev);
651 }
652 }
653
654 String[] includeHandler = configuration.getStringArray(RuntimeConstants.EVENTHANDLER_INCLUDE);
655 if ( includeHandler != null )
656 {
657 for ( int i=0; i < includeHandler.length; i++ )
658 {
659 EventHandler ev = initializeSpecificEventHandler(includeHandler[i],RuntimeConstants.EVENTHANDLER_INCLUDE,IncludeEventHandler.class);
660 if (ev != null)
661 eventCartridge.addIncludeEventHandler((IncludeEventHandler) ev);
662 }
663 }
664
665 String[] invalidReferenceSet = configuration.getStringArray(RuntimeConstants.EVENTHANDLER_INVALIDREFERENCES);
666 if ( invalidReferenceSet != null )
667 {
668 for ( int i=0; i < invalidReferenceSet.length; i++ )
669 {
670 EventHandler ev = initializeSpecificEventHandler(invalidReferenceSet[i],RuntimeConstants.EVENTHANDLER_INVALIDREFERENCES,InvalidReferenceEventHandler.class);
671 if (ev != null)
672 {
673 eventCartridge.addInvalidReferenceEventHandler((InvalidReferenceEventHandler) ev);
674 }
675 }
676 }
677
678
679 }
680
681 private EventHandler initializeSpecificEventHandler(String classname, String paramName, Class EventHandlerInterface)
682 throws Exception
683 {
684 if ( classname != null && classname.length() > 0)
685 {
686 Object o = null;
687 try {
688 o = ClassUtils.getNewInstance(classname);
689 }
690 catch (ClassNotFoundException cnfe )
691 {
692 String err = "The specified class for "
693 + paramName + " (" + classname
694 + ") does not exist or is not accessible to the current classloader.";
695 log.error(err);
696 throw new Exception(err);
697 }
698
699 if (!EventHandlerInterface.isAssignableFrom(EventHandlerInterface))
700 {
701 String err = "The specified class for " + paramName + " ("
702 + classname + ") does not implement "
703 + EventHandlerInterface.getName()
704 + "; Velocity is not initialized correctly.";
705
706 log.error(err);
707 throw new Exception(err);
708 }
709
710 EventHandler ev = (EventHandler) o;
711 if ( ev instanceof RuntimeServicesAware )
712 ((RuntimeServicesAware) ev).setRuntimeServices(this);
713 return ev;
714
715 } else
716 return null;
717 }
718
719
720
721
722
723
724 private void initializeLog() throws Exception
725 {
726
727
728 LogManager.updateLog(this.log, this);
729 }
730
731
732
733
734
735
736
737
738
739
740
741 private void initializeDirectives()
742 throws Exception
743 {
744
745
746
747
748 runtimeDirectives = new Hashtable();
749
750 Properties directiveProperties = new Properties();
751
752
753
754
755
756
757 InputStream inputStream = null;
758
759 try
760 {
761 inputStream = getClass().getResourceAsStream('/' + DEFAULT_RUNTIME_DIRECTIVES);
762
763 if (inputStream == null)
764 {
765 throw new Exception("Error loading directive.properties! " +
766 "Something is very wrong if these properties " +
767 "aren't being located. Either your Velocity " +
768 "distribution is incomplete or your Velocity " +
769 "jar file is corrupted!");
770 }
771
772 directiveProperties.load(inputStream);
773
774 }
775 catch (IOException ioe)
776 {
777 log.error("Error while loading directive properties!", ioe);
778 }
779 finally
780 {
781 try
782 {
783 if (inputStream != null)
784 {
785 inputStream.close();
786 }
787 }
788 catch (IOException ioe)
789 {
790 log.error("Cannot close directive properties!", ioe);
791 }
792 }
793
794
795
796
797
798
799
800
801 Enumeration directiveClasses = directiveProperties.elements();
802
803 while (directiveClasses.hasMoreElements())
804 {
805 String directiveClass = (String) directiveClasses.nextElement();
806 loadDirective(directiveClass);
807 log.debug("Loaded System Directive: " + directiveClass);
808 }
809
810
811
812
813
814 String[] userdirective = configuration.getStringArray("userdirective");
815
816 for( int i = 0; i < userdirective.length; i++)
817 {
818 loadDirective(userdirective[i]);
819 if (log.isInfoEnabled())
820 {
821 log.info("Loaded User Directive: " + userdirective[i]);
822 }
823 }
824
825 }
826
827
828
829
830
831
832 private void loadDirective(String directiveClass)
833 {
834 try
835 {
836 Object o = ClassUtils.getNewInstance( directiveClass );
837
838 if (o instanceof Directive)
839 {
840 Directive directive = (Directive) o;
841 runtimeDirectives.put(directive.getName(), directive);
842 }
843 else
844 {
845 log.error(directiveClass + " does not implement "
846 + Directive.class.getName() + "; it cannot be loaded.");
847 }
848 }
849
850
851
852 catch (Exception e)
853 {
854 log.error("Failed to load Directive: " + directiveClass, e);
855 }
856 }
857
858
859
860
861
862 private void initializeParserPool() throws Exception
863 {
864
865
866
867 String pp = getString(RuntimeConstants.PARSER_POOL_CLASS);
868
869 if (pp != null && pp.length() > 0)
870 {
871
872
873
874
875
876
877 Object o = null;
878
879 try
880 {
881 o = ClassUtils.getNewInstance( pp );
882 }
883 catch (ClassNotFoundException cnfe )
884 {
885 String err = "The specified class for ParserPool ("
886 + pp
887 + ") does not exist (or is not accessible to the current classloader.";
888 log.error(err);
889 throw new Exception(err);
890 }
891
892 if (!(o instanceof ParserPool))
893 {
894 String err = "The specified class for ParserPool ("
895 + pp + ") does not implement " + ParserPool.class
896 + " Velocity not initialized correctly.";
897
898 log.error(err);
899 throw new Exception(err);
900 }
901
902 parserPool = (ParserPool) o;
903
904 parserPool.initialize(this);
905 }
906 else
907 {
908
909
910
911
912 String err = "It appears that no class was specified as the"
913 + " ParserPool. Please ensure that all configuration"
914 + " information is correct.";
915
916 log.error(err);
917 throw new Exception( err );
918 }
919
920 }
921
922
923
924
925
926
927 public Parser createNewParser()
928 {
929
930 if (!initialized && !initializing)
931 {
932 log.debug("Velocity was not initialized! Calling init()...");
933 try
934 {
935 init();
936 }
937 catch (Exception e)
938 {
939 getLog().error("Could not auto-initialize Velocity", e);
940 throw new IllegalStateException("Velocity could not be initialized!");
941 }
942 }
943
944 Parser parser = new Parser(this);
945 parser.setDirectives(runtimeDirectives);
946 return parser;
947 }
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966 public SimpleNode parse(Reader reader, String templateName)
967 throws ParseException
968 {
969
970
971
972 return parse(reader, templateName, true);
973 }
974
975
976
977
978
979
980
981
982
983
984 public SimpleNode parse(Reader reader, String templateName, boolean dumpNamespace)
985 throws ParseException
986 {
987
988 if (!initialized && !initializing)
989 {
990 log.debug("Velocity was not initialized! Calling init()...");
991 try
992 {
993 init();
994 }
995 catch (Exception e)
996 {
997 getLog().error("Could not auto-initialize Velocity", e);
998 throw new IllegalStateException("Velocity could not be initialized!");
999 }
1000 }
1001
1002 SimpleNode ast = null;
1003 Parser parser = (Parser) parserPool.get();
1004
1005 if (parser == null)
1006 {
1007
1008
1009
1010
1011
1012 if (log.isInfoEnabled())
1013 {
1014 log.info("Runtime : ran out of parsers. Creating a new one. "
1015 + " Please increment the parser.pool.size property."
1016 + " The current value is too small.");
1017 }
1018
1019 parser = createNewParser();
1020
1021 }
1022
1023
1024
1025
1026
1027 if (parser != null)
1028 {
1029 try
1030 {
1031
1032
1033
1034
1035
1036
1037 if (dumpNamespace)
1038 {
1039 dumpVMNamespace(templateName);
1040 }
1041
1042 ast = parser.parse(reader, templateName);
1043 }
1044 finally
1045 {
1046
1047
1048
1049 parserPool.put(parser);
1050
1051 }
1052 }
1053 else
1054 {
1055 log.error("Runtime : ran out of parsers and unable to create more.");
1056 }
1057 return ast;
1058 }
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074 public Template getTemplate(String name)
1075 throws ResourceNotFoundException, ParseErrorException, Exception
1076 {
1077 return getTemplate(name, getString( INPUT_ENCODING, ENCODING_DEFAULT));
1078 }
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092 public Template getTemplate(String name, String encoding)
1093 throws ResourceNotFoundException, ParseErrorException, Exception
1094 {
1095
1096 if (!initialized && !initializing)
1097 {
1098 log.info("Velocity not initialized yet. Calling init()...");
1099 init();
1100 }
1101
1102 return (Template)
1103 resourceManager.getResource(name,
1104 ResourceManager.RESOURCE_TEMPLATE, encoding);
1105 }
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119 public ContentResource getContent(String name)
1120 throws ResourceNotFoundException, ParseErrorException, Exception
1121 {
1122
1123
1124
1125
1126
1127 return getContent(name, getString( INPUT_ENCODING, ENCODING_DEFAULT));
1128 }
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142 public ContentResource getContent(String name, String encoding)
1143 throws ResourceNotFoundException, ParseErrorException, Exception
1144 {
1145
1146 if (!initialized && !initializing)
1147 {
1148 log.info("Velocity not initialized yet. Calling init()...");
1149 init();
1150 }
1151
1152 return (ContentResource)
1153 resourceManager.getResource(name,
1154 ResourceManager.RESOURCE_CONTENT, encoding);
1155 }
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167 public String getLoaderNameForResource(String resourceName)
1168 {
1169
1170 if (!initialized && !initializing)
1171 {
1172 log.debug("Velocity was not initialized! Calling init()...");
1173 try
1174 {
1175 init();
1176 }
1177 catch (Exception e)
1178 {
1179 getLog().error("Could not initialize Velocity", e);
1180 throw new IllegalStateException("Velocity could not be initialized!");
1181 }
1182 }
1183
1184 return resourceManager.getLoaderNameForResource(resourceName);
1185 }
1186
1187
1188
1189
1190
1191
1192
1193 public Log getLog()
1194 {
1195 return log;
1196 }
1197
1198
1199
1200
1201
1202
1203 public void warn(Object message)
1204 {
1205 getLog().warn(message);
1206 }
1207
1208
1209
1210
1211
1212
1213 public void info(Object message)
1214 {
1215 getLog().info(message);
1216 }
1217
1218
1219
1220
1221
1222
1223 public void error(Object message)
1224 {
1225 getLog().error(message);
1226 }
1227
1228
1229
1230
1231
1232
1233 public void debug(Object message)
1234 {
1235 getLog().debug(message);
1236 }
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247 public String getString( String key, String defaultValue)
1248 {
1249 return configuration.getString(key, defaultValue);
1250 }
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260 public Directive getVelocimacro(String vmName, String templateName)
1261 {
1262 return vmFactory.getVelocimacro( vmName, templateName );
1263 }
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276 public boolean addVelocimacro( String name,
1277 String macro,
1278 String argArray[],
1279 String sourceTemplate )
1280 {
1281 return vmFactory.addVelocimacro(name, macro, argArray, sourceTemplate);
1282 }
1283
1284
1285
1286
1287
1288
1289
1290
1291 public boolean isVelocimacro( String vmName, String templateName )
1292 {
1293 return vmFactory.isVelocimacro(vmName, templateName);
1294 }
1295
1296
1297
1298
1299
1300
1301
1302 public boolean dumpVMNamespace(String namespace)
1303 {
1304 return vmFactory.dumpVMNamespace( namespace );
1305 }
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324 public String getString(String key)
1325 {
1326 return StringUtils.nullTrim(configuration.getString(key));
1327 }
1328
1329
1330
1331
1332
1333
1334
1335 public int getInt(String key)
1336 {
1337 return configuration.getInt(key);
1338 }
1339
1340
1341
1342
1343
1344
1345
1346
1347 public int getInt(String key, int defaultValue)
1348 {
1349 return configuration.getInt(key, defaultValue);
1350 }
1351
1352
1353
1354
1355
1356
1357
1358
1359 public boolean getBoolean(String key, boolean def)
1360 {
1361 return configuration.getBoolean(key, def);
1362 }
1363
1364
1365
1366
1367
1368
1369
1370 public ExtendedProperties getConfiguration()
1371 {
1372 return configuration;
1373 }
1374
1375
1376
1377
1378
1379 public Introspector getIntrospector()
1380 {
1381 return introspector;
1382 }
1383
1384
1385
1386
1387
1388 public EventCartridge getApplicationEventCartridge()
1389 {
1390 return eventCartridge;
1391 }
1392
1393
1394
1395
1396
1397
1398
1399
1400 public Object getApplicationAttribute(Object key)
1401 {
1402 return applicationAttributes.get(key);
1403 }
1404
1405
1406
1407
1408
1409
1410
1411
1412 public Object setApplicationAttribute(Object key, Object o)
1413 {
1414 return applicationAttributes.put(key, o);
1415 }
1416
1417
1418
1419
1420
1421
1422 public Uberspect getUberspect()
1423 {
1424 return uberSpect;
1425 }
1426
1427 }