Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Removed some obsolete model classes

Rich Turnerf172b8a6031f
diff --git a/model/src/main/java/org/openremote/model/device/Capability.java b/model/src/main/java/org/openremote/model/device/Capability.java
deleted file mode 100644
index d671ce7e1..000000000
--- a/model/src/main/java/org/openremote/model/device/Capability.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.openremote.model.device;
-
-import org.openremote.model.attribute.Attribute;
-
-import java.util.List;
-
-/**
- * Analogous to an Object in LWM2M; note the mandatory field
- * has been removed to make the device object model flexible.
- *
- * Idea is that we have a repository of capabilities that can
- * be implemented by devices.
- *
- * Example capabilities are: -
- *
- * 3 = DeviceInfo
- * 3311 = Light Control
- */
-// TODO Not used
-public class Capability implements CapabilityDefinition {
- protected String type;
- protected String name;
- protected String description;
- protected List<Attribute> resources;
-
- @Override
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getName() {
- return name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public List<Attribute> getResources() {
- return resources;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public void setResources(List<Attribute> resources) {
- this.resources = resources;
- }
-}
diff --git a/model/src/main/java/org/openremote/model/device/CapabilityDefinition.java b/model/src/main/java/org/openremote/model/device/CapabilityDefinition.java
deleted file mode 100644
index ac1b691c9..000000000
--- a/model/src/main/java/org/openremote/model/device/CapabilityDefinition.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.openremote.model.device;
-
-import org.openremote.model.attribute.Attribute;
-
-import java.util.List;
-
-// TODO Not used
-public interface CapabilityDefinition {
- String getType();
-
- String getDescription();
-
- List<Attribute> getResources();
-}
diff --git a/model/src/main/java/org/openremote/model/device/CapabilityRef.java b/model/src/main/java/org/openremote/model/device/CapabilityRef.java
deleted file mode 100644
index 3cdf4eed4..000000000
--- a/model/src/main/java/org/openremote/model/device/CapabilityRef.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.openremote.model.device;
-
-// TODO Not used
-public class CapabilityRef {/*
-extends Attribute {
-
- protected Attributes resources;
-
- public CapabilityRef(JsonObject jsonObject) {
- super(jsonObject.get("name"), jsonObject);
- }
-
- public CapabilityRef(String name, String capabilityType, Attributes resourceRefs) {
- super(name, AttributeValueType.OBJECT);
- jsonObject.put("name", name);
- setCapabilityType(capabilityType);
- setResourceRefs(resourceRefs);
- }
-
- public String getCapabilityType() {
- return jsonObject.getString("capabilityType");
- }
-
- public void setCapabilityType(String capabilityType) {
- jsonObject.put("capabilityType", capabilityType);
- }
-
- public Attributes getResourceRefs() {
- JsonObject refsObj = jsonObject.getObject("resourceRefs");
- return refsObj == null ? null : new Attributes(refsObj);
- }
-
- public void setResourceRefs(Attributes resourceRefs) {
- jsonObject.put("resourceRefs", resourceRefs.getJsonObject());
- }
- */
-}
diff --git a/model/src/main/java/org/openremote/model/device/DeviceResource.java b/model/src/main/java/org/openremote/model/device/DeviceResource.java
deleted file mode 100644
index 063eb1e4b..000000000
--- a/model/src/main/java/org/openremote/model/device/DeviceResource.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright 2016, OpenRemote Inc.
- *
- * See the CONTRIBUTORS.txt file in the distribution for a
- * full listing of individual contributors.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.openremote.model.device;
-
-/**
- * An attribute of an asset that represents a device resource.
- *
- * The value of the attribute is the key of the device resource. Metadata is used
- * to express:
- *
- * <ul>
- * <li>access read only, write only, or read-write</li>
- * <li>the type of the value you read and write from this resource</li>
- * <li>if the resource is passive (polling necessary) or capable of actively pushing values</li>
- * <li>if the resource value is a constant and can be cached forever</li>
- * </ul>
- */
-public class DeviceResource { /* NOT USED
-extends Attribute {
-
- public static final String DEVICE_RESOURCE = "deviceResource";
- public static final String DEVICE_RESOURCE_TYPE = Constants.NAMESPACE + ":device:resource:type";
- public static final String ACCESS = "access";
- public static final String ACCESS_TYPE = Constants.NAMESPACE + ":device:resource:access";
- public static final String PASSIVE = "passive";
- public static final String CONSTANT = "constant";
-
- public enum Access {
- R,
- W,
- RW
- }
-
- public static boolean isDeviceResource(Attribute attribute) {
- // The given attribute must satisfy the API of this class
- return false;
- return attribute.hasMetadataElement(DEVICE_RESOURCE)
- && attribute.getMetadata().getElement(DEVICE_RESOURCE).getName().equals(DEVICE_RESOURCE_TYPE)
- && AttributeValueType.isValid(attribute.getMetadata().getElement(DEVICE_RESOURCE).getValue().asString())
- && attribute.hasMetadataElement(ACCESS)
- && attribute.getMetadata().getElement(ACCESS).getName().equals(ACCESS_TYPE);
- }
-
- public DeviceResource(Attribute attribute) {
- super(attribute.getName(), attribute.getJsonObject());
- }
-
- public DeviceResource(String name, JsonObject jsonObject) {
- super(name, jsonObject);
- }
-
- public DeviceResource(String name, String key, AttributeValueType resourceType, Access access) {
- super(name, AttributeValueType.STRING, Json.create(key));
- /*
- setMetadata(new Metadata()
- .putElement(
- new MetadataElement(DEVICE_RESOURCE, DEVICE_RESOURCE_TYPE, Json.create(resourceType.getValue()))
- )
- .putElement(
- new MetadataElement(ACCESS, ACCESS_TYPE, Json.create(access.name()))
- )
- );
- }
-
- public AttributeValueType getResourceType() {
- return null;
-
- return getMetadata().hasElement(DEVICE_RESOURCE)
- && AttributeValueType.isValid(getMetadata().getElement(DEVICE_RESOURCE).getValue().asString())
- ? AttributeValueType.fromValue(getMetadata().getElement(DEVICE_RESOURCE).getValue().asString())
- : null;
- }
-
- public Access getAccess() {
- return null;
- return getMetadata().hasElement(ACCESS)
- ? Access.valueOf(getMetadata().getElement(ACCESS).getValue().asString())
- : null;
- }
-
- public boolean isPassive() {
- return false;
- return getMetadata().hasElement(PASSIVE) && getMetadata().getElement(PASSIVE).getValue().asBoolean();
- }
-
- public DeviceResource setPassive(boolean passive) {
- if (passive) {
- getMetadata().putElement(
- new MetadataElement(PASSIVE, AttributeValueType.BOOLEAN.getValue(), Json.create(true))
- );
- } else {
- getMetadata().removeElement(PASSIVE);
- }
- return this;
- }
-
- public boolean isConstant() {
- return false;
- return getMetadata().hasElement(CONSTANT) && getMetadata().getElement(CONSTANT).getValue().asBoolean();
- }
-
- public DeviceResource setConstant(boolean constant) {
- if (constant) {
- getMetadata().putElement(
- new MetadataElement(CONSTANT, AttributeValueType.BOOLEAN.getValue(), Json.create(true))
- );
- } else {
- getMetadata().removeElement(CONSTANT);
- }
- return this;
- }
-*/
-}
diff --git a/model/src/main/java/org/openremote/model/device/DeviceResourceRef.java b/model/src/main/java/org/openremote/model/device/DeviceResourceRef.java
deleted file mode 100644
index 9d9430f37..000000000
--- a/model/src/main/java/org/openremote/model/device/DeviceResourceRef.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package org.openremote.model.device;
-
-// TODO Not used
-public class DeviceResourceRef {
- protected String deviceUri;
- protected String resourceUri;
- protected Object resourceValue;
-}
\ No newline at end of file
diff --git a/model/src/main/java/org/openremote/model/device/ResourceRef.java b/model/src/main/java/org/openremote/model/device/ResourceRef.java
deleted file mode 100644
index ed838fa24..000000000
--- a/model/src/main/java/org/openremote/model/device/ResourceRef.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.openremote.model.device;
-
-// TODO Not used
-public class ResourceRef {
-
- protected String uri;
- protected String valueConverter;
-
- public String getUri() {
- return uri;
- }
-
- public void setUri(String uri) {
- this.uri = uri;
- }
-
- public String getValueConverter() {
- return valueConverter;
- }
-
- public void setValueConverter(String valueConverter) {
- this.valueConverter = valueConverter;
- }
-}