This repository has been archived by the owner on May 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 781
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Chris Jackson <[email protected]>
- Loading branch information
Showing
17 changed files
with
865 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
extensions/persistence/org.eclipse.smarthome.persistence.h2sql/.classpath
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> | ||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> | ||
<classpathentry kind="src" path="java"/> | ||
<classpathentry kind="lib" path="lib/h2-1.3.176.jar"/> | ||
<classpathentry kind="output" path="target/classes"/> | ||
</classpath> |
33 changes: 33 additions & 0 deletions
33
extensions/persistence/org.eclipse.smarthome.persistence.h2sql/.project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>org.eclipse.smarthome.persistence.h2sql</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.ManifestBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.SchemaBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.ds.core.builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.pde.PluginNature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
7 changes: 7 additions & 0 deletions
7
.../persistence/org.eclipse.smarthome.persistence.h2sql/.settings/org.eclipse.jdt.core.prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 | ||
org.eclipse.jdt.core.compiler.compliance=1.6 | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.6 |
2 changes: 2 additions & 0 deletions
2
...ns/persistence/org.eclipse.smarthome.persistence.h2sql/.settings/org.eclipse.jdt.ui.prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
eclipse.preferences.version=1 | ||
formatter_settings_version=12 |
3 changes: 3 additions & 0 deletions
3
.../persistence/org.eclipse.smarthome.persistence.h2sql/.settings/org.eclipse.pde.core.prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
eclipse.preferences.version=1 | ||
pluginProject.extensions=false | ||
resolve.requirebundle=false |
24 changes: 24 additions & 0 deletions
24
extensions/persistence/org.eclipse.smarthome.persistence.h2sql/META-INF/MANIFEST.MF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Manifest-Version: 1.0 | ||
Bundle-ManifestVersion: 2 | ||
Bundle-Name: Eclipse SmartHome H2SQL Persistence Service | ||
Bundle-SymbolicName: org.eclipse.smarthome.persistence.h2sql | ||
Bundle-Version: 0.9.0.qualifier | ||
Bundle-Vendor: openHAB.org | ||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7 | ||
DynamicImport-Package: * | ||
Import-Package: org.apache.commons.io, | ||
org.apache.commons.lang, | ||
org.eclipse.smarthome.core.items, | ||
org.eclipse.smarthome.core.library.items, | ||
org.eclipse.smarthome.core.library.types, | ||
org.eclipse.smarthome.core.persistence, | ||
org.eclipse.smarthome.core.types, | ||
org.openhab.core.library.types, | ||
org.osgi.framework, | ||
org.osgi.service.cm, | ||
org.slf4j | ||
Bundle-ClassPath: ., | ||
lib/h2-1.3.176.jar | ||
Service-Component: OSGI-INF/h2sql.xml | ||
Bundle-ActivationPolicy: lazy | ||
Bundle-Activator: org.eclipse.smarthome.persistence.h2sql.internal.H2SqlPersistenceServiceActivator |
20 changes: 20 additions & 0 deletions
20
extensions/persistence/org.eclipse.smarthome.persistence.h2sql/OSGI-INF/h2sql.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 2010-2015, openHAB.org 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 | ||
--> | ||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="activate" deactivate="deactivate" name="org.eclipse.smarthome.persistence.h2sql"> | ||
<implementation class="org.eclipse.smarthome.persistence.h2sql.internal.H2SqlPersistenceService"/> | ||
<service> | ||
<provide interface="org.osgi.service.cm.ManagedService"/> | ||
<provide interface="org.eclipse.smarthome.core.persistence.PersistenceService"/> | ||
</service> | ||
<reference bind="setItemRegistry" cardinality="0..1" interface="org.eclipse.smarthome.core.items.ItemRegistry" name="ItemRegistry" policy="dynamic" unbind="unsetItemRegistry"/> | ||
<property name="service.pid" type="String" value="org.eclipse.smarthome.persistence.h2sql"/> | ||
</scr:component> |
6 changes: 6 additions & 0 deletions
6
extensions/persistence/org.eclipse.smarthome.persistence.h2sql/build.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
output.. = target/classes/ | ||
bin.includes = META-INF/,\ | ||
OSGI-INF/,\ | ||
.,\ | ||
lib/h2-1.3.176.jar | ||
source.. = java/ |
53 changes: 53 additions & 0 deletions
53
...stence.h2sql/java/org/eclipse/smarthome/persistence/h2sql/internal/H2SqlHistoricItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/** | ||
* Copyright (c) 2010-2015, openHAB.org 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.persistence.h2sql.internal; | ||
|
||
import java.text.DateFormat; | ||
import java.util.Date; | ||
|
||
import org.eclipse.smarthome.core.persistence.HistoricItem; | ||
import org.eclipse.smarthome.core.types.State; | ||
|
||
|
||
/** | ||
* This is a Java bean used to return historic items from a SQL database. | ||
* | ||
* @author Chris Jackson - Initial contribution | ||
* | ||
*/ | ||
public class H2SqlHistoricItem implements HistoricItem { | ||
|
||
final private String name; | ||
final private State state; | ||
final private Date timestamp; | ||
|
||
public H2SqlHistoricItem(String name, State state, Date timestamp) { | ||
this.name = name; | ||
this.state = state; | ||
this.timestamp = timestamp; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public State getState() { | ||
return state; | ||
} | ||
|
||
public Date getTimestamp() { | ||
return timestamp; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return DateFormat.getDateTimeInstance().format(timestamp) + ": " + name + " -> "+ state.toString(); | ||
} | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
...nce.h2sql/java/org/eclipse/smarthome/persistence/h2sql/internal/H2SqlPersistenceItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* Copyright (c) 2010-2015, openHAB.org 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.persistence.h2sql.internal; | ||
|
||
import org.eclipse.smarthome.core.persistence.PersistenceItemInfo; | ||
|
||
/** | ||
* This is a Java bean used to return items from a SQL database. | ||
* | ||
* @author Chris Jackson - Initial contribution | ||
* | ||
*/ | ||
public class H2SqlPersistenceItem implements PersistenceItemInfo { | ||
|
||
final private String name; | ||
final private Integer rows; | ||
|
||
public H2SqlPersistenceItem(String name, Integer rows) { | ||
this.name = name; | ||
this.rows = rows; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public Integer getRows() { | ||
return rows; | ||
} | ||
} |
Oops, something went wrong.