diff --git a/bundles/model/org.eclipse.smarthome.model.core/META-INF/MANIFEST.MF b/bundles/model/org.eclipse.smarthome.model.core/META-INF/MANIFEST.MF
index 247a6f94..257e8320 100644
--- a/bundles/model/org.eclipse.smarthome.model.core/META-INF/MANIFEST.MF
+++ b/bundles/model/org.eclipse.smarthome.model.core/META-INF/MANIFEST.MF
@@ -8,6 +8,7 @@ Bundle-Vendor: Eclipse.org/SmartHome
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: com.google.common.base,
com.google.common.collect,
+ com.google.inject,
org.apache.commons.collections;version="3.2.0",
org.apache.commons.io,
org.apache.commons.lang;version="2.3.0",
diff --git a/bundles/model/org.eclipse.smarthome.model.core/src/main/java/org/eclipse/smarthome/model/core/ModelInjectorProvider.java b/bundles/model/org.eclipse.smarthome.model.core/src/main/java/org/eclipse/smarthome/model/core/ModelInjectorProvider.java
new file mode 100644
index 00000000..123f2712
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.core/src/main/java/org/eclipse/smarthome/model/core/ModelInjectorProvider.java
@@ -0,0 +1,8 @@
+package org.eclipse.smarthome.model.core;
+
+import com.google.inject.Injector;
+
+public interface ModelInjectorProvider {
+
+ Injector getInjector();
+}
diff --git a/bundles/model/org.eclipse.smarthome.model.item.runtime/.classpath b/bundles/model/org.eclipse.smarthome.model.item.runtime/.classpath
new file mode 100644
index 00000000..098194ca
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.item.runtime/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/bundles/model/org.eclipse.smarthome.model.item.runtime/.project b/bundles/model/org.eclipse.smarthome.model.item.runtime/.project
new file mode 100644
index 00000000..9dbd3bde
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.item.runtime/.project
@@ -0,0 +1,33 @@
+
+
+ org.eclipse.smarthome.model.item.runtime
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+ org.eclipse.pde.ds.core.builder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/bundles/model/org.eclipse.smarthome.model.item.runtime/.settings/org.eclipse.jdt.core.prefs b/bundles/model/org.eclipse.smarthome.model.item.runtime/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000..f42de363
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.item.runtime/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/bundles/model/org.eclipse.smarthome.model.item.runtime/META-INF/MANIFEST.MF b/bundles/model/org.eclipse.smarthome.model.item.runtime/META-INF/MANIFEST.MF
new file mode 100644
index 00000000..fb671394
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.item.runtime/META-INF/MANIFEST.MF
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Eclipse SmartHome Item Model Runtime
+Bundle-SymbolicName: org.eclipse.smarthome.model.item.runtime;singleton:=true
+Bundle-Version: 0.7.0.qualifier
+Bundle-Activator: org.eclipse.smarthome.model.item.runtime.internal.ItemRuntimeActivator
+Require-Bundle: org.eclipse.smarthome.model.item,
+ com.google.inject
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Import-Package: org.eclipse.smarthome.model.core,
+ org.osgi.framework,
+ org.slf4j
+Service-Component: OSGI-INF/iteminjectorprovider.xml
+Bundle-ActivationPolicy: lazy
+Bundle-Vendor: Eclipse.org/SmartHome
diff --git a/bundles/model/org.eclipse.smarthome.model.item.runtime/OSGI-INF/iteminjectorprovider.xml b/bundles/model/org.eclipse.smarthome.model.item.runtime/OSGI-INF/iteminjectorprovider.xml
new file mode 100644
index 00000000..49fe3e0e
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.item.runtime/OSGI-INF/iteminjectorprovider.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
diff --git a/bundles/model/org.eclipse.smarthome.model.item.runtime/build.properties b/bundles/model/org.eclipse.smarthome.model.item.runtime/build.properties
new file mode 100644
index 00000000..c58ea217
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.item.runtime/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ OSGI-INF/
diff --git a/bundles/model/org.eclipse.smarthome.model.item.runtime/src/org/eclipse/smarthome/model/item/runtime/internal/ItemRuntimeActivator.java b/bundles/model/org.eclipse.smarthome.model.item.runtime/src/org/eclipse/smarthome/model/item/runtime/internal/ItemRuntimeActivator.java
new file mode 100644
index 00000000..edf731fe
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.item.runtime/src/org/eclipse/smarthome/model/item/runtime/internal/ItemRuntimeActivator.java
@@ -0,0 +1,56 @@
+/**
+ * Copyright (c) 2014 openHAB UG (haftungsbeschränkt) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.eclipse.smarthome.model.item.runtime.internal;
+
+import org.eclipse.smarthome.model.ItemsStandaloneSetup;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.inject.Injector;
+
+
+public class ItemRuntimeActivator implements BundleActivator {
+
+ private final static Logger logger = LoggerFactory.getLogger(ItemRuntimeActivator.class);
+
+ private static ItemRuntimeActivator INSTANCE;
+
+ private Injector injector;
+
+ public void start(BundleContext context) throws Exception {
+ INSTANCE = this;
+ getInjector();
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ injector = null;
+ INSTANCE = null;
+ }
+
+ public static ItemRuntimeActivator getInstance() {
+ return INSTANCE;
+ }
+
+ public Injector getInjector() {
+ synchronized (this) {
+ if (injector == null) {
+ injector = createInjector();
+ }
+ return injector;
+ }
+ }
+
+ protected Injector createInjector() {
+ Injector injector = new ItemsStandaloneSetup().createInjectorAndDoEMFRegistration();
+ logger.debug("Registered 'item' configuration parser");
+ return injector;
+ }
+
+}
diff --git a/bundles/model/org.eclipse.smarthome.model.item.runtime/src/org/eclipse/smarthome/model/item/runtime/internal/ItemRuntimeInjectorProvider.java b/bundles/model/org.eclipse.smarthome.model.item.runtime/src/org/eclipse/smarthome/model/item/runtime/internal/ItemRuntimeInjectorProvider.java
new file mode 100644
index 00000000..92682263
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.item.runtime/src/org/eclipse/smarthome/model/item/runtime/internal/ItemRuntimeInjectorProvider.java
@@ -0,0 +1,13 @@
+package org.eclipse.smarthome.model.item.runtime.internal;
+
+import org.eclipse.smarthome.model.core.ModelInjectorProvider;
+
+import com.google.inject.Injector;
+
+public class ItemRuntimeInjectorProvider implements ModelInjectorProvider {
+
+ public Injector getInjector() {
+ return ItemRuntimeActivator.getInstance().getInjector();
+ }
+
+}
diff --git a/bundles/model/org.eclipse.smarthome.model.item.ui/META-INF/MANIFEST.MF b/bundles/model/org.eclipse.smarthome.model.item.ui/META-INF/MANIFEST.MF
index df23f0e2..2f2ea6b5 100644
--- a/bundles/model/org.eclipse.smarthome.model.item.ui/META-INF/MANIFEST.MF
+++ b/bundles/model/org.eclipse.smarthome.model.item.ui/META-INF/MANIFEST.MF
@@ -20,8 +20,9 @@ Import-Package: com.google.common.collect,
org.apache.log4j,
org.eclipse.smarthome.core.items,
org.eclipse.smarthome.designer.ui,
- org.osgi.service.event,
- org.eclipse.xtext.xbase.lib
+ org.eclipse.smarthome.model.core,
+ org.eclipse.xtext.xbase.lib,
+ org.osgi.service.event
Export-Package: org.eclipse.smarthome.model.ui.contentassist.antlr,
org.eclipse.smarthome.model.ui.contentassist,
org.eclipse.smarthome.model.ui.quickfix,
diff --git a/bundles/model/org.eclipse.smarthome.model.item.ui/OSGI-INF/iteminjectorprovider.xml b/bundles/model/org.eclipse.smarthome.model.item.ui/OSGI-INF/iteminjectorprovider.xml
new file mode 100644
index 00000000..72a9b7ca
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.item.ui/OSGI-INF/iteminjectorprovider.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
diff --git a/bundles/model/org.eclipse.smarthome.model.item.ui/src/org/eclipse/smarthome/model/ui/internal/ItemUiInjectorProvider.java b/bundles/model/org.eclipse.smarthome.model.item.ui/src/org/eclipse/smarthome/model/ui/internal/ItemUiInjectorProvider.java
new file mode 100644
index 00000000..e2390bf8
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.item.ui/src/org/eclipse/smarthome/model/ui/internal/ItemUiInjectorProvider.java
@@ -0,0 +1,14 @@
+package org.eclipse.smarthome.model.ui.internal;
+
+import org.eclipse.smarthome.model.core.ModelInjectorProvider;
+
+import com.google.inject.Injector;
+
+public class ItemUiInjectorProvider implements ModelInjectorProvider {
+
+ @Override
+ public Injector getInjector() {
+ return ItemsActivator.getInstance().getInjector(ItemsActivator.ORG_ECLIPSE_SMARTHOME_MODEL_ITEMS);
+ }
+
+}
diff --git a/bundles/model/org.eclipse.smarthome.model.persistence.runtime/.classpath b/bundles/model/org.eclipse.smarthome.model.persistence.runtime/.classpath
new file mode 100644
index 00000000..098194ca
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.persistence.runtime/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/bundles/model/org.eclipse.smarthome.model.persistence.runtime/.project b/bundles/model/org.eclipse.smarthome.model.persistence.runtime/.project
new file mode 100644
index 00000000..e350bd29
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.persistence.runtime/.project
@@ -0,0 +1,28 @@
+
+
+ org.eclipse.smarthome.model.persistence.runtime
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/bundles/model/org.eclipse.smarthome.model.persistence.runtime/.settings/org.eclipse.jdt.core.prefs b/bundles/model/org.eclipse.smarthome.model.persistence.runtime/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000..f42de363
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.persistence.runtime/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/bundles/model/org.eclipse.smarthome.model.persistence.runtime/META-INF/MANIFEST.MF b/bundles/model/org.eclipse.smarthome.model.persistence.runtime/META-INF/MANIFEST.MF
new file mode 100644
index 00000000..4e4a9bea
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.persistence.runtime/META-INF/MANIFEST.MF
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Eclipse SmartHome Persistence Runtime
+Bundle-Vendor: Eclipse.org/SmartHome
+Bundle-Version: 0.7.0.qualifier
+Bundle-SymbolicName: org.eclipse.smarthome.model.persistence.runtime;singleton:=true
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Require-Bundle: org.eclipse.smarthome.model.persistence,
+ com.google.inject
+Import-Package: org.osgi.framework,
+ org.slf4j
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.eclipse.smarthome.model.persistence.runtime.internal.PersistenceRuntimeActivator
diff --git a/bundles/model/org.eclipse.smarthome.model.persistence.runtime/build.properties b/bundles/model/org.eclipse.smarthome.model.persistence.runtime/build.properties
new file mode 100644
index 00000000..34d2e4d2
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.persistence.runtime/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/bundles/model/org.eclipse.smarthome.model.persistence.runtime/src/org/eclipse/smarthome/model/persistence/runtime/internal/PersistenceRuntimeActivator.java b/bundles/model/org.eclipse.smarthome.model.persistence.runtime/src/org/eclipse/smarthome/model/persistence/runtime/internal/PersistenceRuntimeActivator.java
new file mode 100644
index 00000000..65d964cf
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.persistence.runtime/src/org/eclipse/smarthome/model/persistence/runtime/internal/PersistenceRuntimeActivator.java
@@ -0,0 +1,29 @@
+/**
+ * Copyright (c) 2014 openHAB UG (haftungsbeschränkt) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.eclipse.smarthome.model.persistence.runtime.internal;
+
+import org.eclipse.smarthome.model.persistence.PersistenceStandaloneSetup;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class PersistenceRuntimeActivator implements BundleActivator {
+
+ private final static Logger logger = LoggerFactory.getLogger(PersistenceRuntimeActivator.class);
+
+ public void start(BundleContext context) throws Exception {
+ new PersistenceStandaloneSetup().createInjectorAndDoEMFRegistration();
+ logger.debug("Registered 'persistence' configuration parser");
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ }
+
+}
diff --git a/bundles/model/org.eclipse.smarthome.model.rule.runtime/.classpath b/bundles/model/org.eclipse.smarthome.model.rule.runtime/.classpath
new file mode 100644
index 00000000..098194ca
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.rule.runtime/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/bundles/model/org.eclipse.smarthome.model.rule.runtime/.project b/bundles/model/org.eclipse.smarthome.model.rule.runtime/.project
new file mode 100644
index 00000000..3bd4ad50
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.rule.runtime/.project
@@ -0,0 +1,33 @@
+
+
+ org.eclipse.smarthome.model.rule.runtime
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+ org.eclipse.pde.ds.core.builder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/bundles/model/org.eclipse.smarthome.model.rule.runtime/.settings/org.eclipse.jdt.core.prefs b/bundles/model/org.eclipse.smarthome.model.rule.runtime/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000..f42de363
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.rule.runtime/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/bundles/model/org.eclipse.smarthome.model.rule.runtime/META-INF/MANIFEST.MF b/bundles/model/org.eclipse.smarthome.model.rule.runtime/META-INF/MANIFEST.MF
new file mode 100644
index 00000000..a011ad8f
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.rule.runtime/META-INF/MANIFEST.MF
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Eclipse SmartHome Rule Runtime
+Bundle-Vendor: Eclipse.org/SmartHome
+Bundle-Version: 0.7.0.qualifier
+Bundle-SymbolicName: org.eclipse.smarthome.model.rule.runtime;singleton:=true
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Require-Bundle: org.eclipse.smarthome.model.rule,
+ com.google.inject
+Import-Package: org.eclipse.smarthome.model.core,
+ org.osgi.framework,
+ org.slf4j
+Bundle-ActivationPolicy: lazy
+Service-Component: OSGI-INF/rulesinjectorprovider.xml
+Bundle-Activator: org.eclipse.smarthome.model.rule.runtime.internal.RulesRuntimeActivator
diff --git a/bundles/model/org.eclipse.smarthome.model.rule.runtime/OSGI-INF/rulesinjectorprovider.xml b/bundles/model/org.eclipse.smarthome.model.rule.runtime/OSGI-INF/rulesinjectorprovider.xml
new file mode 100644
index 00000000..3742876d
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.rule.runtime/OSGI-INF/rulesinjectorprovider.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
diff --git a/bundles/model/org.eclipse.smarthome.model.rule.runtime/build.properties b/bundles/model/org.eclipse.smarthome.model.rule.runtime/build.properties
new file mode 100644
index 00000000..c58ea217
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.rule.runtime/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ OSGI-INF/
diff --git a/bundles/model/org.eclipse.smarthome.model.rule.runtime/src/org/eclipse/smarthome/model/rule/runtime/internal/RulesRuntimeActivator.java b/bundles/model/org.eclipse.smarthome.model.rule.runtime/src/org/eclipse/smarthome/model/rule/runtime/internal/RulesRuntimeActivator.java
new file mode 100644
index 00000000..7dbc99a9
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.rule.runtime/src/org/eclipse/smarthome/model/rule/runtime/internal/RulesRuntimeActivator.java
@@ -0,0 +1,56 @@
+/**
+ * Copyright (c) 2014 openHAB UG (haftungsbeschränkt) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.eclipse.smarthome.model.rule.runtime.internal;
+
+import org.eclipse.smarthome.model.rule.RulesStandaloneSetup;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.inject.Injector;
+
+
+public class RulesRuntimeActivator implements BundleActivator {
+
+ private final static Logger logger = LoggerFactory.getLogger(RulesRuntimeActivator.class);
+
+ private static RulesRuntimeActivator INSTANCE;
+
+ private Injector injector;
+
+ public void start(BundleContext context) throws Exception {
+ INSTANCE = this;
+ getInjector();
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ injector = null;
+ INSTANCE = null;
+ }
+
+ public static RulesRuntimeActivator getInstance() {
+ return INSTANCE;
+ }
+
+ public Injector getInjector() {
+ synchronized (this) {
+ if (injector == null) {
+ injector = createInjector();
+ }
+ return injector;
+ }
+ }
+
+ protected Injector createInjector() {
+ Injector injector = new RulesStandaloneSetup().createInjectorAndDoEMFRegistration();
+ logger.debug("Registered 'rules' configuration parser");
+ return injector;
+ }
+
+}
diff --git a/bundles/model/org.eclipse.smarthome.model.rule.runtime/src/org/eclipse/smarthome/model/rule/runtime/internal/RulesRuntimeInjectorProvider.java b/bundles/model/org.eclipse.smarthome.model.rule.runtime/src/org/eclipse/smarthome/model/rule/runtime/internal/RulesRuntimeInjectorProvider.java
new file mode 100644
index 00000000..969b0e4b
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.rule.runtime/src/org/eclipse/smarthome/model/rule/runtime/internal/RulesRuntimeInjectorProvider.java
@@ -0,0 +1,13 @@
+package org.eclipse.smarthome.model.rule.runtime.internal;
+
+import org.eclipse.smarthome.model.core.ModelInjectorProvider;
+
+import com.google.inject.Injector;
+
+public class RulesRuntimeInjectorProvider implements ModelInjectorProvider {
+
+ public Injector getInjector() {
+ return RulesRuntimeActivator.getInstance().getInjector();
+ }
+
+}
diff --git a/bundles/model/org.eclipse.smarthome.model.rule.ui/META-INF/MANIFEST.MF b/bundles/model/org.eclipse.smarthome.model.rule.ui/META-INF/MANIFEST.MF
index 6707c2d9..db686e98 100644
--- a/bundles/model/org.eclipse.smarthome.model.rule.ui/META-INF/MANIFEST.MF
+++ b/bundles/model/org.eclipse.smarthome.model.rule.ui/META-INF/MANIFEST.MF
@@ -30,6 +30,7 @@ Import-Package: com.google.common.base,
org.eclipse.smarthome.core.persistence,
org.eclipse.smarthome.core.scriptengine,
org.eclipse.smarthome.core.scriptengine.action,
+ org.eclipse.smarthome.model.core,
org.eclipse.smarthome.model.persistence.extensions,
org.eclipse.xtext.xbase.lib,
org.joda.time,
diff --git a/bundles/model/org.eclipse.smarthome.model.rule.ui/OSGI-INF/rulesinjectorprovider.xml b/bundles/model/org.eclipse.smarthome.model.rule.ui/OSGI-INF/rulesinjectorprovider.xml
new file mode 100644
index 00000000..dd8db6f1
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.rule.ui/OSGI-INF/rulesinjectorprovider.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
diff --git a/bundles/model/org.eclipse.smarthome.model.rule.ui/src/org/eclipse/smarthome/model/rule/ui/internal/RuleUiInjectorProvider.java b/bundles/model/org.eclipse.smarthome.model.rule.ui/src/org/eclipse/smarthome/model/rule/ui/internal/RuleUiInjectorProvider.java
new file mode 100644
index 00000000..8a9db229
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.rule.ui/src/org/eclipse/smarthome/model/rule/ui/internal/RuleUiInjectorProvider.java
@@ -0,0 +1,14 @@
+package org.eclipse.smarthome.model.rule.ui.internal;
+
+import org.eclipse.smarthome.model.core.ModelInjectorProvider;
+
+import com.google.inject.Injector;
+
+public class RuleUiInjectorProvider implements ModelInjectorProvider {
+
+ @Override
+ public Injector getInjector() {
+ return RuleModelUIActivator.getInstance().getInjector(RuleModelUIActivator.ORG_ECLIPSE_SMARTHOME_MODEL_RULE_RULES);
+ }
+
+}
diff --git a/bundles/model/org.eclipse.smarthome.model.script.runtime/.classpath b/bundles/model/org.eclipse.smarthome.model.script.runtime/.classpath
new file mode 100644
index 00000000..098194ca
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.script.runtime/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/bundles/model/org.eclipse.smarthome.model.script.runtime/.project b/bundles/model/org.eclipse.smarthome.model.script.runtime/.project
new file mode 100644
index 00000000..a0e47045
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.script.runtime/.project
@@ -0,0 +1,33 @@
+
+
+ org.eclipse.smarthome.model.script.runtime
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+ org.eclipse.pde.ds.core.builder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/bundles/model/org.eclipse.smarthome.model.script.runtime/.settings/org.eclipse.jdt.core.prefs b/bundles/model/org.eclipse.smarthome.model.script.runtime/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000..f42de363
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.script.runtime/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/bundles/model/org.eclipse.smarthome.model.script.runtime/META-INF/MANIFEST.MF b/bundles/model/org.eclipse.smarthome.model.script.runtime/META-INF/MANIFEST.MF
new file mode 100644
index 00000000..63c89ba3
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.script.runtime/META-INF/MANIFEST.MF
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Eclipse SmartHome Script Runtime
+Bundle-Vendor: Eclipse.org/SmartHome
+Bundle-Version: 0.7.0.qualifier
+Bundle-SymbolicName: org.eclipse.smarthome.model.script.runtime;singleton:=true
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Require-Bundle: org.eclipse.smarthome.model.script,
+ com.google.inject
+Import-Package: org.eclipse.smarthome.model.core,
+ org.osgi.framework,
+ org.slf4j
+Bundle-ActivationPolicy: lazy
+Service-Component: OSGI-INF/scriptinjectorprovider.xml
+Bundle-Activator: org.eclipse.smarthome.model.script.runtime.internal.ScriptRuntimeActivator
diff --git a/bundles/model/org.eclipse.smarthome.model.script.runtime/OSGI-INF/scriptinjectorprovider.xml b/bundles/model/org.eclipse.smarthome.model.script.runtime/OSGI-INF/scriptinjectorprovider.xml
new file mode 100644
index 00000000..863ea742
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.script.runtime/OSGI-INF/scriptinjectorprovider.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
diff --git a/bundles/model/org.eclipse.smarthome.model.script.runtime/build.properties b/bundles/model/org.eclipse.smarthome.model.script.runtime/build.properties
new file mode 100644
index 00000000..c58ea217
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.script.runtime/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ OSGI-INF/
diff --git a/bundles/model/org.eclipse.smarthome.model.script.runtime/src/org/eclipse/smarthome/model/script/runtime/internal/ScriptRuntimeActivator.java b/bundles/model/org.eclipse.smarthome.model.script.runtime/src/org/eclipse/smarthome/model/script/runtime/internal/ScriptRuntimeActivator.java
new file mode 100644
index 00000000..77d3342c
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.script.runtime/src/org/eclipse/smarthome/model/script/runtime/internal/ScriptRuntimeActivator.java
@@ -0,0 +1,55 @@
+/**
+ * Copyright (c) 2014 openHAB UG (haftungsbeschränkt) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.eclipse.smarthome.model.script.runtime.internal;
+import org.eclipse.smarthome.model.script.ScriptStandaloneSetup;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.inject.Injector;
+
+
+public class ScriptRuntimeActivator implements BundleActivator {
+
+ private final static Logger logger = LoggerFactory.getLogger(ScriptRuntimeActivator.class);
+
+ private static ScriptRuntimeActivator INSTANCE;
+
+ private Injector injector;
+
+ public void start(BundleContext context) throws Exception {
+ INSTANCE = this;
+ getInjector();
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ injector = null;
+ INSTANCE = null;
+ }
+
+ public static ScriptRuntimeActivator getInstance() {
+ return INSTANCE;
+ }
+
+ public Injector getInjector() {
+ synchronized (this) {
+ if (injector == null) {
+ injector = createInjector();
+ }
+ return injector;
+ }
+ }
+
+ protected Injector createInjector() {
+ Injector injector = new ScriptStandaloneSetup().createInjectorAndDoEMFRegistration();
+ logger.debug("Registered 'script' configuration parser");
+ return injector;
+ }
+
+}
diff --git a/bundles/model/org.eclipse.smarthome.model.script.runtime/src/org/eclipse/smarthome/model/script/runtime/internal/ScriptRuntimeInjectorProvider.java b/bundles/model/org.eclipse.smarthome.model.script.runtime/src/org/eclipse/smarthome/model/script/runtime/internal/ScriptRuntimeInjectorProvider.java
new file mode 100644
index 00000000..5a51f87b
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.script.runtime/src/org/eclipse/smarthome/model/script/runtime/internal/ScriptRuntimeInjectorProvider.java
@@ -0,0 +1,13 @@
+package org.eclipse.smarthome.model.script.runtime.internal;
+
+import org.eclipse.smarthome.model.core.ModelInjectorProvider;
+
+import com.google.inject.Injector;
+
+public class ScriptRuntimeInjectorProvider implements ModelInjectorProvider {
+
+ public Injector getInjector() {
+ return ScriptRuntimeActivator.getInstance().getInjector();
+ }
+
+}
diff --git a/bundles/model/org.eclipse.smarthome.model.script.ui/META-INF/MANIFEST.MF b/bundles/model/org.eclipse.smarthome.model.script.ui/META-INF/MANIFEST.MF
index c9b99780..33eb053e 100644
--- a/bundles/model/org.eclipse.smarthome.model.script.ui/META-INF/MANIFEST.MF
+++ b/bundles/model/org.eclipse.smarthome.model.script.ui/META-INF/MANIFEST.MF
@@ -28,6 +28,7 @@ Import-Package: com.google.common.base,
org.eclipse.smarthome.core.persistence,
org.eclipse.smarthome.core.scriptengine.action,
org.eclipse.smarthome.core.types,
+ org.eclipse.smarthome.model.core,
org.eclipse.smarthome.model.persistence.extensions,
org.eclipse.xtext.xbase.lib,
org.joda.time,
diff --git a/bundles/model/org.eclipse.smarthome.model.script.ui/OSGI-INF/scriptinjectorprovider.xml b/bundles/model/org.eclipse.smarthome.model.script.ui/OSGI-INF/scriptinjectorprovider.xml
new file mode 100644
index 00000000..1ac49eeb
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.script.ui/OSGI-INF/scriptinjectorprovider.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
diff --git a/bundles/model/org.eclipse.smarthome.model.script.ui/build.properties b/bundles/model/org.eclipse.smarthome.model.script.ui/build.properties
index 9331a5d9..546d3a77 100644
--- a/bundles/model/org.eclipse.smarthome.model.script.ui/build.properties
+++ b/bundles/model/org.eclipse.smarthome.model.script.ui/build.properties
@@ -4,4 +4,5 @@ source.. = src/,\
bin.includes = META-INF/,\
.,\
plugin.xml,\
- icons/
+ icons/,\
+ OSGI-INF/
diff --git a/bundles/model/org.eclipse.smarthome.model.script.ui/src/org/eclipse/smarthome/model/script/ui/internal/ScriptUiInjectorProvider.java b/bundles/model/org.eclipse.smarthome.model.script.ui/src/org/eclipse/smarthome/model/script/ui/internal/ScriptUiInjectorProvider.java
new file mode 100644
index 00000000..5d7b34d9
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.script.ui/src/org/eclipse/smarthome/model/script/ui/internal/ScriptUiInjectorProvider.java
@@ -0,0 +1,14 @@
+package org.eclipse.smarthome.model.script.ui.internal;
+
+import org.eclipse.smarthome.model.core.ModelInjectorProvider;
+
+import com.google.inject.Injector;
+
+public class ScriptUiInjectorProvider implements ModelInjectorProvider {
+
+ @Override
+ public Injector getInjector() {
+ return ScriptUIActivator.getInstance().getInjector(ScriptUIActivator.ORG_ECLIPSE_SMARTHOME_MODEL_SCRIPT_SCRIPT);
+ }
+
+}
diff --git a/bundles/model/org.eclipse.smarthome.model.script/OSGI-INF/scriptengine.xml b/bundles/model/org.eclipse.smarthome.model.script/OSGI-INF/scriptengine.xml
index 5ef7c429..61234354 100644
--- a/bundles/model/org.eclipse.smarthome.model.script/OSGI-INF/scriptengine.xml
+++ b/bundles/model/org.eclipse.smarthome.model.script/OSGI-INF/scriptengine.xml
@@ -13,4 +13,5 @@
+
diff --git a/bundles/model/org.eclipse.smarthome.model.script/src/org/eclipse/smarthome/model/script/internal/engine/ScriptEngineImpl.java b/bundles/model/org.eclipse.smarthome.model.script/src/org/eclipse/smarthome/model/script/internal/engine/ScriptEngineImpl.java
index 1b70b87b..d0dc767d 100644
--- a/bundles/model/org.eclipse.smarthome.model.script/src/org/eclipse/smarthome/model/script/internal/engine/ScriptEngineImpl.java
+++ b/bundles/model/org.eclipse.smarthome.model.script/src/org/eclipse/smarthome/model/script/internal/engine/ScriptEngineImpl.java
@@ -22,7 +22,7 @@ import org.eclipse.smarthome.core.scriptengine.Script;
import org.eclipse.smarthome.core.scriptengine.ScriptEngine;
import org.eclipse.smarthome.core.scriptengine.ScriptExecutionException;
import org.eclipse.smarthome.core.scriptengine.ScriptParsingException;
-import org.eclipse.smarthome.model.script.ScriptStandaloneSetup;
+import org.eclipse.smarthome.model.core.ModelInjectorProvider;
import org.eclipse.xtext.diagnostics.Severity;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.resource.XtextResourceSet;
@@ -34,7 +34,6 @@ import org.eclipse.xtext.validation.Issue;
import org.eclipse.xtext.xbase.XExpression;
import com.google.common.base.Predicate;
-import com.google.inject.Inject;
import com.google.inject.Injector;
/**
@@ -46,40 +45,28 @@ import com.google.inject.Injector;
@SuppressWarnings("restriction")
public class ScriptEngineImpl implements ScriptEngine {
- protected Injector guiceInjector;
-
-
+
protected XtextResourceSet resourceSet;
+
+ private Injector injector;
public ScriptEngineImpl() {}
public void activate() {
}
-
- @Inject
- public void setGuiceInjector(Injector injector) {
- this.guiceInjector = injector;
- }
-
- private Injector getInjector() {
- if (guiceInjector == null) {
- guiceInjector = new ScriptStandaloneSetup().createInjectorAndDoEMFRegistration();
- }
- return guiceInjector;
- }
-
+
private XtextResourceSet getResourceSet() {
if (resourceSet == null) {
- resourceSet = guiceInjector.getInstance(XtextResourceSet.class);
+ resourceSet = injector.getInstance(XtextResourceSet.class);
resourceSet.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);
}
return resourceSet;
}
public void deactivate() {
- this.guiceInjector = null;
+ this.injector = null;
this.resourceSet = null;
}
@@ -95,7 +82,7 @@ public class ScriptEngineImpl implements ScriptEngine {
* {@inheritDoc}
*/
public Script newScriptFromXExpression(XExpression expression) {
- ScriptImpl script = getInjector().getInstance(ScriptImpl.class);
+ ScriptImpl script = injector.getInstance(ScriptImpl.class);
script.setXExpression(expression);
return script;
}
@@ -162,5 +149,13 @@ public class ScriptEngineImpl implements ScriptEngine {
});
return issues;
}
+
+ public void setInjectorProvider(ModelInjectorProvider injectorProvider) {
+ this.injector = injectorProvider.getInjector();
+ }
+
+ public void unsetInjectorProvider(ModelInjectorProvider injectorProvider) {
+ this.injector = null;
+ }
}
diff --git a/bundles/model/org.eclipse.smarthome.model.sitemap.runtime/.classpath b/bundles/model/org.eclipse.smarthome.model.sitemap.runtime/.classpath
new file mode 100644
index 00000000..098194ca
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.sitemap.runtime/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/bundles/model/org.eclipse.smarthome.model.sitemap.runtime/.project b/bundles/model/org.eclipse.smarthome.model.sitemap.runtime/.project
new file mode 100644
index 00000000..1b44ba0b
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.sitemap.runtime/.project
@@ -0,0 +1,28 @@
+
+
+ org.eclipse.smarthome.model.sitemap.runtime
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/bundles/model/org.eclipse.smarthome.model.sitemap.runtime/.settings/org.eclipse.jdt.core.prefs b/bundles/model/org.eclipse.smarthome.model.sitemap.runtime/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000..f42de363
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.sitemap.runtime/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/bundles/model/org.eclipse.smarthome.model.sitemap.runtime/META-INF/MANIFEST.MF b/bundles/model/org.eclipse.smarthome.model.sitemap.runtime/META-INF/MANIFEST.MF
new file mode 100644
index 00000000..7cd5a922
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.sitemap.runtime/META-INF/MANIFEST.MF
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Eclipse SmartHome Sitemap Runtime
+Bundle-Vendor: Eclipse.org/SmartHome
+Bundle-Version: 0.7.0.qualifier
+Bundle-SymbolicName: org.eclipse.smarthome.model.sitemap.runtime;singleton:=true
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Require-Bundle: org.eclipse.smarthome.model.sitemap,
+ com.google.inject
+Import-Package: org.osgi.framework,
+ org.slf4j
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.eclipse.smarthome.model.sitemap.runtime.internal.SitemapRuntimeActivator
diff --git a/bundles/model/org.eclipse.smarthome.model.sitemap.runtime/build.properties b/bundles/model/org.eclipse.smarthome.model.sitemap.runtime/build.properties
new file mode 100644
index 00000000..34d2e4d2
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.sitemap.runtime/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/bundles/model/org.eclipse.smarthome.model.sitemap.runtime/src/org/eclipse/smarthome/model/sitemap/runtime/internal/SitemapRuntimeActivator.java b/bundles/model/org.eclipse.smarthome.model.sitemap.runtime/src/org/eclipse/smarthome/model/sitemap/runtime/internal/SitemapRuntimeActivator.java
new file mode 100644
index 00000000..9daae891
--- /dev/null
+++ b/bundles/model/org.eclipse.smarthome.model.sitemap.runtime/src/org/eclipse/smarthome/model/sitemap/runtime/internal/SitemapRuntimeActivator.java
@@ -0,0 +1,29 @@
+/**
+ * Copyright (c) 2014 openHAB UG (haftungsbeschränkt) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.eclipse.smarthome.model.sitemap.runtime.internal;
+
+import org.eclipse.smarthome.model.SitemapStandaloneSetup;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class SitemapRuntimeActivator implements BundleActivator {
+
+ private final static Logger logger = LoggerFactory.getLogger(SitemapRuntimeActivator.class);
+
+ public void start(BundleContext context) throws Exception {
+ new SitemapStandaloneSetup().createInjectorAndDoEMFRegistration();
+ logger.debug("Registered 'sitemap' configuration parser");
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ }
+
+}
diff --git a/targetplatform/SmartHome Designer (Mac).launch b/targetplatform/SmartHome Designer (Mac).launch
index 954b1b8f..a8b60852 100644
--- a/targetplatform/SmartHome Designer (Mac).launch
+++ b/targetplatform/SmartHome Designer (Mac).launch
@@ -15,7 +15,7 @@
-
+
diff --git a/targetplatform/SmartHome Runtime.launch b/targetplatform/SmartHome Runtime.launch
index e52ae650..7446888e 100644
--- a/targetplatform/SmartHome Runtime.launch
+++ b/targetplatform/SmartHome Runtime.launch
@@ -23,7 +23,7 @@
-
+