summaryrefslogtreecommitdiffstats
path: root/vaadin-app/src/ch/asynk
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-10-06 10:31:37 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-10-06 10:31:37 +0200
commit500d88f0b33ccdec130e2676bdd6e82cf385841a (patch)
tree0bd806796c6b80d93258d209251b92326103e084 /vaadin-app/src/ch/asynk
parentc9e1a2df6ade1428d2785538272dc6357414d696 (diff)
downloadskeletons-500d88f0b33ccdec130e2676bdd6e82cf385841a.zip
skeletons-500d88f0b33ccdec130e2676bdd6e82cf385841a.tar.gz
add Context class
Diffstat (limited to 'vaadin-app/src/ch/asynk')
-rw-r--r--vaadin-app/src/ch/asynk/helloworld/Context.java55
1 files changed, 55 insertions, 0 deletions
diff --git a/vaadin-app/src/ch/asynk/helloworld/Context.java b/vaadin-app/src/ch/asynk/helloworld/Context.java
new file mode 100644
index 0000000..c59016d
--- /dev/null
+++ b/vaadin-app/src/ch/asynk/helloworld/Context.java
@@ -0,0 +1,55 @@
+package ch.asynk.helloworld;
+
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class Context {
+ //
+ private static final long serialVersionUID = 1L;
+ //
+ private Logger log = Logger.getLogger("ch.asynk");
+ public Logger getLogger() {
+ return log;
+ }
+ //
+ private Properties props = null;
+ public Properties getProps() {
+ return props;
+ }
+ //
+ private HelloWorldApp app = null;
+ public HelloWorldApp getApp() {
+ return app;
+ }
+ //
+ public Context(HelloWorldApp application) {
+ app = application;
+ initProps();
+ }
+ //
+ private void initProps() {
+ props = new Properties();
+ //
+ String properties_file = "Application.properties";
+ log.info("doing stuff : ");
+ java.io.InputStream is = null;
+ try {
+ is = HelloWorldApp.class.getClassLoader().getResourceAsStream(properties_file);
+ }
+ catch(java.lang.Exception x) {
+ log.log(Level.SEVERE,"Error loading "+properties_file+"' properties",x);
+ return;
+ }
+ if (is!=null) {
+ try {
+ props.load(is);
+ }
+ catch (java.io.IOException e) {
+ log.log(Level.SEVERE,"Error reading properties '"+properties_file+"' ",e);
+ }
+ } else {
+ log.warning("'"+properties_file+"' file not found");
+ }
+ }
+}