Merge "Add oneM2M arduino clients" into dev
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/constants/DBEntities.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/constants/DBEntities.java
index a3017c6..4d560f6 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/constants/DBEntities.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/constants/DBEntities.java
@@ -24,12 +24,13 @@
import org.eclipse.om2m.commons.entities.AccessControlRuleEntity;
import org.eclipse.om2m.commons.entities.AeAnncEntity;
import org.eclipse.om2m.commons.entities.AeEntity;
-import org.eclipse.om2m.commons.entities.CreatedAnnouncedResourceEntity;
import org.eclipse.om2m.commons.entities.CSEBaseEntity;
import org.eclipse.om2m.commons.entities.ContainerEntity;
import org.eclipse.om2m.commons.entities.ContentInstanceEntity;
+import org.eclipse.om2m.commons.entities.CreatedAnnouncedResourceEntity;
import org.eclipse.om2m.commons.entities.CustomAttributeEntity;
import org.eclipse.om2m.commons.entities.DynamicAuthorizationConsultationEntity;
+import org.eclipse.om2m.commons.entities.FlexContainerAnncEntity;
import org.eclipse.om2m.commons.entities.FlexContainerEntity;
import org.eclipse.om2m.commons.entities.LabelEntity;
import org.eclipse.om2m.commons.entities.PollingChannelEntity;
@@ -111,6 +112,8 @@
public static final String NODE_ENTITY = "NODE";
+ public static final String NODE_ANNC_ENTITY = "NODEA";
+
/**
* Name used for the persisted (@link {@link CustomAttributeEntity} entity
*/
@@ -380,35 +383,49 @@
public static final String REQ_JOIN_ID = "REQ_JOIN_ID";
// NODE - ACP
- public static final String ACPNOD_JOIN = "NOD_ACP_JOIN";
+ public static final String ACP_NOD_JOIN = "NOD_ACP_JOIN";
public static final String NOD_JOIN_ID = "NOD_JOIN_ID";
- public static final String CSBNOD_CH_JOIN = "CSB_NOD_CH_JOIN";
- public static final String CSRNOD_CH_JOIN = "CSR_NOD_CH_JOIN";
- public static final String NODSUB_JOIN = "NOD_SUB_JOIN";
+ public static final String CSB_NOD_CH_JOIN = "CSB_NOD_CH_JOIN";
+ public static final String CSR_NOD_CH_JOIN = "CSR_NOD_CH_JOIN";
+ public static final String NOD_SUB_JOIN = "NOD_SUB_JOIN";
+
+ public static final String ACP_NODANNC_JOIN = "NODANNC_ACP_JOIN";
+ public static final String NODANNC_JOIN_ID = "NODANNC_JOIN_ID";
+ public static final String CSB_NODANNC_CH_JOIN = "CSB_NODANNC_CH_JOIN";
+ public static final String CSR_NODANNC_CH_JOIN = "CSR_NODANNC_CH_JOIN";
+ public static final String NODANNC_SUB_JOIN = "NODANNC_SUB_JOIN";
// NODE - DAC
public static final String NOD_DAC_JOIN = "NOD_DAC_JOIN";
-
+ public static final String NODANNC_DAC_JOIN = "NODANNC_DAC_JOIN";
+
// FCNT - CUSTOM_ATTRIBUTE
public static final String FCNT_CA_JOIN = "FCNT_CA_JOIN";
public static final String CA_JOIN_ID = "CA_ID";
// MGMT OBJ
- public static final String ANISUB_JOIN = "ANI_SUB_JOIN";
- public static final String ANIACP_JOIN = "ANI_ACP_JOIN";
+ // AreaNetworkInfo
+ public static final String ANI_ACP_JOIN = "ANI_ACP_JOIN";
public static final String ANI_DAC_JOIN = "ANI_DAC_JOIN";
public static final String ANI_JOIN_ID = "ANI_JOIN_ID";
- public static final String ANINOD_JOIN = "ANI_NOD_JOIN";
- public static final String ANDISUB_JOIN = "ANDI_SUB_JOIN";
- public static final String ANDI_JOIN_ID = "ANDI_JOIN_ID";
- public static final String ANDINOD_JOIN = "ANDI_NOD_JOIN";
- public static final String ANDIACP_JOIN = "ANDI_ACP_JOIN";
+ public static final String ANI_SUB_JOIN = "ANI_SUB_JOIN";
+ public static final String ANI_NOD_JOIN = "ANI_NOD_JOIN";
+ public static final String ANI_NODANNC_JOIN = "ANI_NODANNC_JOIN";
+ // AreaNetworkDeviceInfo
+ public static final String ANDI_ACP_JOIN = "ANDI_ACP_JOIN";
public static final String ANDI_DAC_JOIN = "ANDI_DAC_JOIN";
-
- public static final String MGMT_OBJECT_JOIN_ID = "MGMT_OBJECT_JOIN_ID";
- public static final String MGMT_OBJECT_ACP_JOIN = "MGMT_OBJECT_ACP_JOIN";
- public static final String MGMT_OBJECT_DAC_JOIN = "MGMT_OBJECT_DAC_JOIN";
+ public static final String ANDI_JOIN_ID = "ANDI_JOIN_ID";
+ public static final String ANDI_SUB_JOIN = "ANDI_SUB_JOIN";
+ public static final String ANDI_NOD_JOIN = "ANDI_NOD_JOIN";
+ public static final String ANDI_NODANNC_JOIN = "ANDI_NODANNC_JOIN";
+ // DeviceInfo
+ public static final String DVI_ACP_JOIN = "DVI_ACP_JOIN";
+ public static final String DVI_DAC_JOIN = "DVI_DAC_JOIN";
+ public static final String DVI_JOIN_ID = "DVI_JOIN_ID";
+ public static final String DVI_SUB_JOIN = "DVI_SUB_JOIN";
+ public static final String DVI_NOD_JOIN = "DVI_NOD_JOIN";
+ public static final String DVI_NODANNC_JOIN = "DVI_NODANNC_JOIN";
// ANNOUNCED RESOURCE
public static final String REMOTE_RESOURCE_ID = "REMOTE_RESOURCE_ID";
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/constants/MgmtDefinitionTypes.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/constants/MgmtDefinitionTypes.java
index 8eebe87..ff448a6 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/constants/MgmtDefinitionTypes.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/constants/MgmtDefinitionTypes.java
@@ -27,7 +27,66 @@
*/
public class MgmtDefinitionTypes {
+ public static final BigInteger FIRMWARE = BigInteger.valueOf(1001);
+ public static final BigInteger SOFTWARE = BigInteger.valueOf(1002);
+ public static final BigInteger MEMORY = BigInteger.valueOf(1003);
public static final BigInteger AREA_NWK_INFO = BigInteger.valueOf(1004);
public static final BigInteger AREA_NWK_DEVICE_INFO = BigInteger.valueOf(1005);
+ public static final BigInteger BATTERY = BigInteger.valueOf(1006);
+ public static final BigInteger DEVICE_INFO = BigInteger.valueOf(1007);
+ public static final BigInteger DEVICE_CAPABILITY = BigInteger.valueOf(1008);
+ public static final BigInteger REBOOT = BigInteger.valueOf(1009);
+ public static final BigInteger EVENT_LOG = BigInteger.valueOf(1010);
+ public static final BigInteger CMDH_POLICY = BigInteger.valueOf(1011);
+ public static final BigInteger ACTIVE_CMDH_POLICY = BigInteger.valueOf(1012);
+ public static final BigInteger CMDH_DEFAULTS = BigInteger.valueOf(1013);
+ public static final BigInteger CMDH_DEF_EC_VALUE = BigInteger.valueOf(1014);
+ public static final BigInteger CMDH_EC_DEF_PARAM_VALUES = BigInteger.valueOf(1015);
+ public static final BigInteger CMDH_LIMITS = BigInteger.valueOf(1016);
+ public static final BigInteger CMDH_NETWORK_ACCESS_RULES = BigInteger.valueOf(1017);
+ public static final BigInteger CMDH_NW_ACCESS_RULE = BigInteger.valueOf(1018);
+ public static final BigInteger CMDH_BUFFER = BigInteger.valueOf(1019);
+
+ public static String getShortName(BigInteger type) {
+ if (type.equals(FIRMWARE))
+ return ShortName.FIRMWARE;
+ if (type.equals(SOFTWARE))
+ return ShortName.SOFTWARE;
+ if (type.equals(MEMORY))
+ return ShortName.MEMORY;
+ if (type.equals(AREA_NWK_INFO))
+ return ShortName.AREA_NWK_INFO;
+ if (type.equals(AREA_NWK_DEVICE_INFO))
+ return ShortName.AREA_NWK_DEVICE_INFO;
+ if (type.equals(BATTERY))
+ return ShortName.BATTERY;
+ if (type.equals(DEVICE_INFO))
+ return ShortName.DEVICE_INFO;
+ if (type.equals(DEVICE_CAPABILITY))
+ return ShortName.DEVICE_CAPABILITY;
+ if (type.equals(REBOOT))
+ return ShortName.REBOOT;
+ if (type.equals(EVENT_LOG))
+ return ShortName.EVENT_LOG;
+ if (type.equals(CMDH_POLICY))
+ return ShortName.CMDH_POLICY;
+ if (type.equals(ACTIVE_CMDH_POLICY))
+ return ShortName.ACTIVE_CMDH_POLICY;
+ if (type.equals(CMDH_DEFAULTS))
+ return ShortName.CMDH_DEFAULTS;
+ if (type.equals(CMDH_DEF_EC_VALUE))
+ return ShortName.CMDH_DEF_EC_VALUE;
+ if (type.equals(CMDH_EC_DEF_PARAM_VALUES))
+ return ShortName.CMDH_EC_DEF_PARAM_VALUES;
+ if (type.equals(CMDH_LIMITS))
+ return ShortName.CMDH_LIMITS;
+ if (type.equals(CMDH_NETWORK_ACCESS_RULES))
+ return ShortName.CMDH_NETWORK_ACCESS_RULES;
+ if (type.equals(CMDH_NW_ACCESS_RULE))
+ return ShortName.CMDH_NW_ACCESS_RULE;
+ if (type.equals(CMDH_BUFFER))
+ return ShortName.CMDH_BUFFER;
+ return null;
+ }
}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/constants/ResourceType.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/constants/ResourceType.java
index b33a439..6f43c95 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/constants/ResourceType.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/constants/ResourceType.java
@@ -53,6 +53,7 @@
public static final int SUBSCRIPTION = 23;
public static final int FLEXCONTAINER = 28;
public static final int DYNAMIC_AUTHORIZATION_CONSULTATION = 34;
+
public static final int ACCESS_CONTROL_POLICY_ANNC = 10001;
public static final int AE_ANNC = 10002;
public static final int CONTAINER_ANNC = 10003;
@@ -65,6 +66,4 @@
public static final int SCHEDULE_ANNC = 10018;
public static final int FLEXCONTAINER_ANNC = 10028;
-
-
}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/constants/ShortName.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/constants/ShortName.java
index 7476dee..008f302 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/constants/ShortName.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/constants/ShortName.java
@@ -106,42 +106,6 @@
public static final String STCG = "stcg";
/** Short name for Subscription resource */
public static final String SUB = "sub";
- /** Short name for Firmware resource */
- public static final String FWR = "fwr";
- /** Short name for Software resource */
- public static final String SWR = "swr";
- /** Short name for Memory resource */
- public static final String MEM = "mem";
- /** Short name for AreaNwkInfo resource */
- public static final String ANI = "ani";
- /** Short name for AreaNwkDeviceInfo resource */
- public static final String ANDI = "andi";
- /** Short name for DeviceInfo resource */
- public static final String DVI = "dvi";
- /** Short name for DeviceCapability resource */
- public static final String DVC = "dvc";
- /** Short name for Reboot resource */
- public static final String RBT = "rbt";
- /** Short name for EventLog resource */
- public static final String EVL = "evl";
- /** Short name for CmdhPolicy resource */
- public static final String CMP = "cmp";
- /** Short name for ActiveCmdhPolicy resource */
- public static final String ACMP = "acmp";
- /** Short name for CmdhDefaults resource */
- public static final String CMDF = "cmdf";
- /** Short name for CmdhDefEcValue resource */
- public static final String CMDV = "cmdv";
- /** Short name for CmdhEcDefParamValues resource */
- public static final String CMPV = "cmpv";
- /** Short name for CmdhLimits resource */
- public static final String CML = "cml";
- /** Short name for CmdhNetworksAccessRules resource */
- public static final String CMNR = "cmnr";
- /** Short name for CmdhNwAccessRule resource */
- public static final String CMWR = "cmwr";
- /** Short name for CmdhBuffer resource */
- public static final String CMBF = "cmbf";
// Resource attributes short names
/** Short name for Resource ID attribute */
@@ -219,8 +183,6 @@
/** Short name for circ region attribute */
public static final String ACCR = "accr";
-
-
// Attributes for Application Entity
/** Short name for App Name Attribute */
public static final String APP_NAME = "apn";
@@ -253,12 +215,10 @@
/** Short name for current number of instances attribute */
public static final String CURRENT_NUMBER_OF_INSTANCES = "cni";
-
// Attributes for FlexContainerEntity
/** Short name for ContainerDefinition attribute */
public static final String CONTAINER_DEFINITION = "cnd";
-
// Attributes for Content Instance
/** Short name for ContentSize attribute */
public static final String CONTENT_SIZE = "cs";
@@ -419,6 +379,7 @@
// Attributes for Node
public static final String NODE_ID = "ni";
public static final String HOSTED_CSE_LINK = "hcl";
+ public static final String HOSTED_APP_LINK = "hapl";
// Short names for mgmt objects generic attributes
public static final String DESCRIPTION = "des";
@@ -427,17 +388,38 @@
public static final String OBJ_PATHS = "obps";
// Short names for mgmt objects specialization
- public static final String MEMORY = "mem";
+ public static final String AREA_NWK_DEVICE_INFO = "andi";
+ public static final String AREA_NWK_INFO = "ani";
public static final String BATTERY = "bat";
- public static final String FIRMWARE = "fwr";
- public static final String SOFTWARE = "swr";
- public static final String DEVICE_INFO = "dvi";
public static final String DEVICE_CAPABILITY = "dvc";
- public static final String REBOOT = "rbo";
+ public static final String DEVICE_INFO = "dvi";
public static final String EVENT_LOG = "evl";
- public static final String CMDH_POLICY = "cmp";
- public static final String ACTIVE_CMDH_POLICY = "acmp";
+ public static final String FIRMWARE = "fwr";
+ public static final String MEMORY = "mem";
+ public static final String REBOOT = "rbo";
+ public static final String SOFTWARE = "swr";
+ public static final String AREA_NWK_DEVICE_INFO_ANNC = "andiA";
+ public static final String AREA_NWK_INFO_ANNC = "aniA";
+ public static final String BATTERY_ANNC = "batA";
+ public static final String DEVICE_CAPABILITY_ANNC = "dvcA";
+ public static final String DEVICE_INFO_ANNC = "dviA";
+ public static final String EVENT_LOG_ANNC = "evlA";
+ public static final String FIRMWARE_ANNC = "fwrA";
+ public static final String MEMORY_ANNC = "memA";
+ public static final String REBOOT_ANNC = "rboA";
+ public static final String SOFTWARE_ANNC = "swrA";
+
+ public static final String ACTIVE_CMDH_POLICY = "acmp";
+ public static final String CMDH_POLICY = "cmp";
+ public static final String CMDH_DEFAULTS = "cmdf";
+ public static final String CMDH_DEF_EC_VALUE= "cmdv";
+ public static final String CMDH_EC_DEF_PARAM_VALUES = "cmpv";
+ public static final String CMDH_LIMITS = "cml";
+ public static final String CMDH_NETWORK_ACCESS_RULES = "cmnr";
+ public static final String CMDH_NW_ACCESS_RULE = "cmwr";
+ public static final String CMDH_BUFFER = "cmbf";
+
// Short names for Custom Attributes
public static final String CUSTOM_ATTRIBUTE_NAME = "can";
public static final String CUSTOM_ATTRIBUTE_TYPE = "cat";
@@ -455,7 +437,31 @@
public static final String SLEEP_INTERVAL = "sli";
public static final String SLEEP_DURATION = "sld";
public static final String LIST_OF_NEIGHBORS = "lnh";
-
+
+ // short names for device info
+ public static final String DEVICE_LABEL = "dlb";
+ public static final String DEVICE_TYPE = "dty";
+ public static final String DEVICE_MODEL = "mod";
+ public static final String MANUFACTURER = "man";
+ public static final String FW_VERSION = "fwv";
+ public static final String SW_VERSION = "swv";
+ public static final String HW_VERSION = "hwv";
+ public static final String OS_VERSION = "osv";
+ public static final String MANUF_DET_LINKS = "mfdtl";
+ public static final String MANUF_DATE = "mfDte";
+ public static final String DEVICE_SUB_MODEL = "sumod";
+ public static final String DEVICE_NAME = "dnm";
+ public static final String COUNTRY = "ctry";
+ public static final String LOCATION = "loc";
+ public static final String SYS_TIME = "syst";
+ public static final String SUPPORT_URL = "surl";
+ public static final String PRES_URL = "purl";
+ public static final String PROTOCOL = "prtl";
+
+ // short names for battery
+ public static final String BATTERY_LEVEL = "btl";
+ public static final String BATTERY_STATUS = "bts";
+
// short name for URI List
public static final String URI_LIST = "uril";
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/AccessControlPolicyEntity.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/AccessControlPolicyEntity.java
index ee11daa..1f93f49 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/AccessControlPolicyEntity.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/AccessControlPolicyEntity.java
@@ -176,7 +176,6 @@
)
protected List<FlexContainerAnncEntity> linkedFlexCntAs;
-
// database link to subscription
@ManyToMany(fetch=FetchType.LAZY, cascade={CascadeType.ALL}, targetEntity = SubscriptionEntity.class)
@JoinTable(
@@ -197,16 +196,15 @@
@ManyToMany(fetch = FetchType.LAZY, targetEntity = NodeEntity.class)
@JoinTable(
- name=DBEntities.ACPNOD_JOIN,
+ name=DBEntities.ACP_NOD_JOIN,
inverseJoinColumns={@JoinColumn(name=DBEntities.NOD_JOIN_ID, referencedColumnName=ShortName.RESOURCE_ID)},
joinColumns={@JoinColumn(name=DBEntities.ACP_JOIN_ID, referencedColumnName=ShortName.RESOURCE_ID)}
)
- protected List<PollingChannelEntity> linkedNod;
+ protected List<NodeEntity> linkedNodes;
- // Database link to ACP
@ManyToMany(fetch = FetchType.LAZY, targetEntity = AreaNwkInfoEntity.class)
@JoinTable(
- name = DBEntities.ANIACP_JOIN,
+ name = DBEntities.ANI_ACP_JOIN,
inverseJoinColumns = { @JoinColumn(name = DBEntities.ANI_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) },
joinColumns = { @JoinColumn(name = DBEntities.ACP_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) }
)
@@ -214,12 +212,20 @@
@ManyToMany(fetch = FetchType.LAZY, targetEntity = AreaNwkDeviceInfoEntity.class)
@JoinTable(
- name = DBEntities.ANDIACP_JOIN,
+ name = DBEntities.ANDI_ACP_JOIN,
inverseJoinColumns = { @JoinColumn(name = DBEntities.ANDI_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) },
joinColumns = { @JoinColumn(name = DBEntities.ACP_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) }
)
protected List<AreaNwkDeviceInfoEntity> areaNwkDeviceInfoEntities;
+ @ManyToMany(fetch = FetchType.LAZY, targetEntity = DeviceInfoEntity.class)
+ @JoinTable(
+ name = DBEntities.DVI_ACP_JOIN,
+ inverseJoinColumns = { @JoinColumn(name = DBEntities.DVI_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) },
+ joinColumns = { @JoinColumn(name = DBEntities.ACP_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) }
+ )
+ protected List<DeviceInfoEntity> deviceInfoEntities;
+
/**
* @return the privileges
@@ -435,20 +441,20 @@
}
/**
- * @return the linkedNod
+ * @return the linkedNodes
*/
- public List<PollingChannelEntity> getLinkedNod() {
- if (this.linkedNod == null) {
- this.linkedNod = new ArrayList<>();
+ public List<NodeEntity> getLinkedNodes() {
+ if (this.linkedNodes == null) {
+ this.linkedNodes = new ArrayList<>();
}
- return linkedNod;
+ return linkedNodes;
}
/**
- * @param linkedNod the linkedNod to set
+ * @param linkedNodes the linkedNodes to set
*/
- public void setLinkedNod(List<PollingChannelEntity> linkedNod) {
- this.linkedNod = linkedNod;
+ public void setLinkedNodes(List<NodeEntity> linkedNodes) {
+ this.linkedNodes = linkedNodes;
}
/**
@@ -486,6 +492,30 @@
this.areaNwkDeviceInfoEntities = areaNwkDeviceInfoEntities;
}
+ /**
+ * @return the deviceInfoEntities
+ */
+ public List<DeviceInfoEntity> getDeviceInfoEntities() {
+ if (this.deviceInfoEntities == null) {
+ this.deviceInfoEntities = new ArrayList<>();
+ }
+ return deviceInfoEntities;
+ }
+
+ /**
+ * @param deviceInfoEntities the deviceInfoEntities to set
+ */
+ public void setDeviceInfoEntities(List<DeviceInfoEntity> deviceInfoEntities) {
+ this.deviceInfoEntities = deviceInfoEntities;
+ }
+
+ public List<MgmtObjEntity> getMgmtObjEntities() {
+ List<MgmtObjEntity> ret = new ArrayList<MgmtObjEntity>();
+ ret.addAll(getAreaNwkInfoEntities());
+ ret.addAll(getAreaNwkDeviceInfoEntities());
+ ret.addAll(getDeviceInfoEntities());
+ return ret;
+ }
public List<DynamicAuthorizationConsultationEntity> getLinkedDynamicAuthorizationConsultation() {
if (linkedDynamicAuthorizationConsultation == null) {
@@ -499,8 +529,6 @@
this.linkedDynamicAuthorizationConsultation = linkedDynamicAuthorizationConsultation;
}
-
-
@Override
public List<DynamicAuthorizationConsultationEntity> getDynamicAuthorizationConsultations() {
if (dynamicConsultationAuthorizations == null) {
@@ -524,7 +552,4 @@
List<AccessControlPolicyEntity> accessControlPolicies) {
}
-
-
-
}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/AreaNwkDeviceInfoEntity.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/AreaNwkDeviceInfoEntity.java
index 9d0bee4..37b844a 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/AreaNwkDeviceInfoEntity.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/AreaNwkDeviceInfoEntity.java
@@ -37,12 +37,14 @@
import org.eclipse.om2m.commons.constants.DBEntities;
import org.eclipse.om2m.commons.constants.MgmtDefinitionTypes;
import org.eclipse.om2m.commons.constants.ShortName;
+import org.eclipse.om2m.commons.resource.AreaNwkDeviceInfo;
+import org.eclipse.om2m.commons.resource.MgmtObj;
/**
* Area Nwk Device Info entity - Specialization of MgmtObj
*
*/
-@Entity(name = ShortName.ANDI)
+@Entity(name = ShortName.AREA_NWK_DEVICE_INFO)
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class AreaNwkDeviceInfoEntity extends MgmtObjEntity {
@@ -64,7 +66,7 @@
/** AccessControlPolicies linked to the MgmtObj */
@ManyToMany(fetch=FetchType.LAZY)
@JoinTable(
- name = DBEntities.ANDIACP_JOIN,
+ name = DBEntities.ANDI_ACP_JOIN,
joinColumns = { @JoinColumn(name = DBEntities.ANDI_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) },
inverseJoinColumns = { @JoinColumn(name = DBEntities.ACP_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) }
)
@@ -83,7 +85,7 @@
// Database link to Subscriptions
@OneToMany(fetch = FetchType.LAZY, targetEntity = SubscriptionEntity.class, mappedBy="parentAndi")
@JoinTable(
- name = DBEntities.ANDISUB_JOIN,
+ name = DBEntities.ANDI_SUB_JOIN,
joinColumns = { @JoinColumn(name = DBEntities.ANDI_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) },
inverseJoinColumns = { @JoinColumn(name = DBEntities.SUB_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) }
)
@@ -92,7 +94,7 @@
// Database link to Node
@ManyToOne(fetch = FetchType.LAZY, targetEntity = NodeEntity.class)
@JoinTable(
- name = DBEntities.ANDINOD_JOIN,
+ name = DBEntities.ANDI_NOD_JOIN,
joinColumns = { @JoinColumn(name = DBEntities.ANDI_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) },
inverseJoinColumns = { @JoinColumn(name = DBEntities.NOD_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) }
)
@@ -264,5 +266,18 @@
public void setDynamicAuthorizationConsultations(List<DynamicAuthorizationConsultationEntity> list) {
this.dynamicAuthorizationConsultations = list;
}
+
+ @Override
+ public void fillFrom(MgmtObj mgmtObj) {
+ super.fillFrom(mgmtObj);
+ AreaNwkDeviceInfo andi = (AreaNwkDeviceInfo) mgmtObj;
+ this.devID = andi.getDevID();
+ this.devType = andi.getDevType();
+ this.areaNwkId = andi.getAreaNwkId();
+ this.sleepDuration = andi.getSleepDuration();
+ this.sleepInterval = andi.getSleepInterval();
+ this.status = andi.getStatus();
+ this.listOfNeighbors = andi.getListOfNeighbors();
+ }
}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/AreaNwkInfoEntity.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/AreaNwkInfoEntity.java
index 43c5f79..2d47ee3 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/AreaNwkInfoEntity.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/AreaNwkInfoEntity.java
@@ -36,12 +36,14 @@
import org.eclipse.om2m.commons.constants.DBEntities;
import org.eclipse.om2m.commons.constants.MgmtDefinitionTypes;
import org.eclipse.om2m.commons.constants.ShortName;
+import org.eclipse.om2m.commons.resource.AreaNwkInfo;
+import org.eclipse.om2m.commons.resource.MgmtObj;
/**
* Area Network Info Entity - Specialization of MgmtObj
*
*/
-@Entity(name = ShortName.ANI)
+@Entity(name = ShortName.AREA_NWK_INFO)
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class AreaNwkInfoEntity extends MgmtObjEntity {
@@ -54,7 +56,7 @@
// Database link to ACP
@ManyToMany(fetch = FetchType.LAZY, targetEntity = AccessControlPolicyEntity.class)
@JoinTable(
- name = DBEntities.ANIACP_JOIN,
+ name = DBEntities.ANI_ACP_JOIN,
joinColumns = { @JoinColumn(name = DBEntities.ANI_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) },
inverseJoinColumns = { @JoinColumn(name = DBEntities.ACP_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) }
)
@@ -72,7 +74,7 @@
// Database link to Subscriptions
@OneToMany(fetch = FetchType.LAZY, targetEntity = SubscriptionEntity.class, mappedBy="parentAni")
@JoinTable(
- name = DBEntities.ANISUB_JOIN,
+ name = DBEntities.ANI_SUB_JOIN,
joinColumns = { @JoinColumn(name = DBEntities.ANI_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) },
inverseJoinColumns = { @JoinColumn(name = DBEntities.SUB_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) }
)
@@ -81,7 +83,7 @@
// Database link to Node
@ManyToOne(fetch = FetchType.LAZY, targetEntity = NodeEntity.class)
@JoinTable(
- name = DBEntities.ANINOD_JOIN,
+ name = DBEntities.ANI_NOD_JOIN,
joinColumns = { @JoinColumn(name = DBEntities.ANI_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) },
inverseJoinColumns = { @JoinColumn(name = DBEntities.NOD_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) }
)
@@ -140,6 +142,20 @@
}
/**
+ * @return the parentNode
+ */
+ public NodeEntity getParentNode() {
+ return parentNode;
+ }
+
+ /**
+ * @param parentNode the parentNode to set
+ */
+ public void setParentNode(NodeEntity parentNode) {
+ this.parentNode = parentNode;
+ }
+
+ /**
* @return the subscriptions
*/
public List<SubscriptionEntity> getSubscriptions() {
@@ -169,5 +185,13 @@
public void setDynamicAuthorizationConsultations(List<DynamicAuthorizationConsultationEntity> list) {
this.dynamicAuthorizationConsultations = list;
}
+
+ @Override
+ public void fillFrom(MgmtObj mgmtObj) {
+ super.fillFrom(mgmtObj);
+ AreaNwkInfo ani = (AreaNwkInfo) mgmtObj;
+ this.areaNwkType = ani.getAreaNwkType();
+ this.listOfDevices = ani.getListOfDevices();
+ }
}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/CSEBaseEntity.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/CSEBaseEntity.java
index cc66b27..c4edc98 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/CSEBaseEntity.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/CSEBaseEntity.java
@@ -80,7 +80,7 @@
/** List of Nodes */
@OneToMany(fetch=FetchType.LAZY, cascade={CascadeType.ALL})
@JoinTable(
- name=DBEntities.CSBNOD_CH_JOIN,
+ name=DBEntities.CSB_NOD_CH_JOIN,
joinColumns={@JoinColumn(name=DBEntities.CSEB_JOIN_ID, referencedColumnName=ShortName.RESOURCE_ID)},
inverseJoinColumns={@JoinColumn(name=DBEntities.NOD_JOIN_ID, referencedColumnName=ShortName.RESOURCE_ID)}
)
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/ContentInstanceEntity.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/ContentInstanceEntity.java
index 8ea3f0d..c78b2be 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/ContentInstanceEntity.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/ContentInstanceEntity.java
@@ -33,7 +33,6 @@
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
-import javax.persistence.OneToMany;
import org.eclipse.om2m.commons.constants.DBEntities;
import org.eclipse.om2m.commons.constants.MimeMediaType;
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/DeviceInfoEntity.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/DeviceInfoEntity.java
new file mode 100644
index 0000000..7ccbd2c
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/DeviceInfoEntity.java
@@ -0,0 +1,469 @@
+/*******************************************************************************
+ * Copyright (c) 2013-2016 LAAS-CNRS (www.laas.fr)
+ * 7 Colonel Roche 31077 Toulouse - France
+ *
+ * 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
+ *
+ * Initial Contributors:
+ * Thierry Monteil : Project manager, technical co-manager
+ * Mahdi Ben Alaya : Technical co-manager
+ * Samir Medjiah : Technical co-manager
+ * Khalil Drira : Strategy expert
+ * Guillaume Garzone : Developer
+ * François Aïssaoui : Developer
+ *
+ * New contributors :
+ *******************************************************************************/
+package org.eclipse.om2m.commons.entities;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+
+import org.eclipse.om2m.commons.constants.DBEntities;
+import org.eclipse.om2m.commons.constants.MgmtDefinitionTypes;
+import org.eclipse.om2m.commons.constants.ShortName;
+import org.eclipse.om2m.commons.resource.DeviceInfo;
+import org.eclipse.om2m.commons.resource.MgmtObj;
+
+/**
+ * Device Info entity - Specialization of MgmtObj
+ *
+ */
+@Entity(name = ShortName.DEVICE_INFO)
+@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+public class DeviceInfoEntity extends MgmtObjEntity {
+
+ @Column(name = ShortName.DEVICE_LABEL)
+ protected String deviceLabel;
+ @Column(name = ShortName.DEVICE_TYPE)
+ protected String deviceType;
+ @Column(name = ShortName.DEVICE_MODEL)
+ protected String model;
+ @Column(name = ShortName.MANUFACTURER)
+ protected String manufacturer;
+
+ @Column(name = ShortName.FW_VERSION)
+ protected String fwVersion;
+ @Column(name = ShortName.SW_VERSION)
+ protected String swVersion;
+ @Column(name = ShortName.HW_VERSION)
+ protected String hwVersion;
+ @Column(name = ShortName.OS_VERSION)
+ protected String osVersion;
+ @Column(name = ShortName.MANUF_DET_LINKS)
+ protected String manufacturerDetailsLink;
+ @Column(name = ShortName.MANUF_DATE)
+ protected String manufacturingDate;
+ @Column(name = ShortName.DEVICE_SUB_MODEL)
+ protected String subModel;
+ @Column(name = ShortName.DEVICE_NAME)
+ protected String deviceName;
+ @Column(name = ShortName.COUNTRY)
+ protected String country;
+ @Column(name = ShortName.LOCATION)
+ protected String location;
+ @Column(name = ShortName.SYS_TIME)
+ protected String systemTime;
+ @Column(name = ShortName.SUPPORT_URL)
+ protected String supportURL;
+ @Column(name = ShortName.PRES_URL)
+ protected String presentationURL;
+ @Column(name = ShortName.PROTOCOL)
+ protected String protocol;
+
+ /** AccessControlPolicies linked to the MgmtObj */
+ @ManyToMany(fetch=FetchType.LAZY)
+ @JoinTable(
+ name = DBEntities.DVI_ACP_JOIN,
+ joinColumns = { @JoinColumn(name = DBEntities.DVI_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) },
+ inverseJoinColumns = { @JoinColumn(name = DBEntities.ACP_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) }
+ )
+ protected List<AccessControlPolicyEntity> accessControlPolicies;
+
+ /** List of DynamicAuthorizationConsultations*/
+ @ManyToMany(fetch=FetchType.LAZY, mappedBy="linkedDeviceInfoEntities")
+ @JoinTable(
+ name = DBEntities.DVI_DAC_JOIN,
+ joinColumns = { @JoinColumn(name = DBEntities.DVI_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) },
+ inverseJoinColumns = { @JoinColumn(name = DBEntities.DAC_JOINID, referencedColumnName = ShortName.RESOURCE_ID) }
+ )
+ protected List<DynamicAuthorizationConsultationEntity> dynamicAuthorizationConsultations;
+
+ // Database link to Subscriptions
+ @OneToMany(fetch = FetchType.LAZY, targetEntity = SubscriptionEntity.class, mappedBy="parentDvi")
+ @JoinTable(
+ name = DBEntities.DVI_SUB_JOIN,
+ joinColumns = { @JoinColumn(name = DBEntities.DVI_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) },
+ inverseJoinColumns = { @JoinColumn(name = DBEntities.SUB_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) }
+ )
+ protected List<SubscriptionEntity> subscriptions;
+
+ // Database link to Node
+ @ManyToOne(fetch = FetchType.LAZY, targetEntity = NodeEntity.class)
+ @JoinTable(
+ name = DBEntities.DVI_NOD_JOIN,
+ joinColumns = { @JoinColumn(name = DBEntities.DVI_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) },
+ inverseJoinColumns = { @JoinColumn(name = DBEntities.NOD_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) }
+ )
+ protected NodeEntity parentNode;
+
+ public DeviceInfoEntity() {
+ this.mgmtDefinition = MgmtDefinitionTypes.DEVICE_INFO;
+ }
+
+ /**
+ * @return the subscriptions
+ */
+ @Override
+ public List<SubscriptionEntity> getSubscriptions() {
+ if (this.subscriptions == null) {
+ this.subscriptions = new ArrayList<>();
+ }
+ return subscriptions;
+ }
+
+ /**
+ * @param subscriptions the subscriptions to set
+ */
+ public void setSubscriptions(List<SubscriptionEntity> subscriptions) {
+ this.subscriptions = subscriptions;
+ }
+
+ /**
+ * @return the parentNode
+ */
+ @Override
+ public NodeEntity getParentNode() {
+ return parentNode;
+ }
+
+ /**
+ * @param parentNode the parentNode to set
+ */
+ @Override
+ public void setParentNode(NodeEntity parentNode) {
+ this.parentNode = parentNode;
+ }
+
+ /**
+ * @return the acps
+ */
+ public List<AccessControlPolicyEntity> getAccessControlPolicies() {
+ if (this.accessControlPolicies == null) {
+ this.accessControlPolicies = new ArrayList<>();
+ }
+ return accessControlPolicies;
+ }
+
+ /**
+ * @param acps the acps to set
+ */
+ public void setAccessControlPolicies(List<AccessControlPolicyEntity> acps) {
+ this.accessControlPolicies = acps;
+ }
+
+
+ @Override
+ public List<DynamicAuthorizationConsultationEntity> getDynamicAuthorizationConsultations() {
+ if (this.dynamicAuthorizationConsultations == null) {
+ this.dynamicAuthorizationConsultations = new ArrayList<>();
+ }
+ return dynamicAuthorizationConsultations;
+ }
+
+ @Override
+ public void setDynamicAuthorizationConsultations(List<DynamicAuthorizationConsultationEntity> list) {
+ this.dynamicAuthorizationConsultations = list;
+ }
+
+ /**
+ * @return the deviceLabel
+ */
+ public String getDeviceLabel() {
+ return deviceLabel;
+ }
+
+ /**
+ * @param deviceLabel the deviceLabel to set
+ */
+ public void setDeviceLabel(String deviceLabel) {
+ this.deviceLabel = deviceLabel;
+ }
+
+ /**
+ * @return the deviceType
+ */
+ public String getDeviceType() {
+ return deviceType;
+ }
+
+ /**
+ * @param deviceType the deviceType to set
+ */
+ public void setDeviceType(String deviceType) {
+ this.deviceType = deviceType;
+ }
+
+ /**
+ * @return the model
+ */
+ public String getModel() {
+ return model;
+ }
+
+ /**
+ * @param model the model to set
+ */
+ public void setModel(String model) {
+ this.model = model;
+ }
+
+ /**
+ * @return the manufacturer
+ */
+ public String getManufacturer() {
+ return manufacturer;
+ }
+
+ /**
+ * @param manufacturer the manufacturer to set
+ */
+ public void setManufacturer(String manufacturer) {
+ this.manufacturer = manufacturer;
+ }
+
+ /**
+ * @return the fwVersion
+ */
+ public String getFwVersion() {
+ return fwVersion;
+ }
+
+ /**
+ * @param fwVersion the fwVersion to set
+ */
+ public void setFwVersion(String fwVersion) {
+ this.fwVersion = fwVersion;
+ }
+
+ /**
+ * @return the swVersion
+ */
+ public String getSwVersion() {
+ return swVersion;
+ }
+
+ /**
+ * @param swVersion the swVersion to set
+ */
+ public void setSwVersion(String swVersion) {
+ this.swVersion = swVersion;
+ }
+
+ /**
+ * @return the hwVersion
+ */
+ public String getHwVersion() {
+ return hwVersion;
+ }
+
+ /**
+ * @param hwVersion the hwVersion to set
+ */
+ public void setHwVersion(String hwVersion) {
+ this.hwVersion = hwVersion;
+ }
+
+ /**
+ * @return the osVersion
+ */
+ public String getOsVersion() {
+ return osVersion;
+ }
+
+ /**
+ * @param osVersion the osVersion to set
+ */
+ public void setOsVersion(String osVersion) {
+ this.osVersion = osVersion;
+ }
+
+ /**
+ * @return the manufacturerDetailsLink
+ */
+ public String getManufacturerDetailsLink() {
+ return manufacturerDetailsLink;
+ }
+
+ /**
+ * @param manufacturerDetailsLink the manufacturerDetailsLink to set
+ */
+ public void setManufacturerDetailsLink(String manufacturerDetailsLink) {
+ this.manufacturerDetailsLink = manufacturerDetailsLink;
+ }
+
+ /**
+ * @return the manufacturingDate
+ */
+ public String getManufacturingDate() {
+ return manufacturingDate;
+ }
+
+ /**
+ * @param manufacturingDate the manufacturingDate to set
+ */
+ public void setManufacturingDate(String manufacturingDate) {
+ this.manufacturingDate = manufacturingDate;
+ }
+
+ /**
+ * @return the subModel
+ */
+ public String getSubModel() {
+ return subModel;
+ }
+
+ /**
+ * @param subModel the subModel to set
+ */
+ public void setSubModel(String subModel) {
+ this.subModel = subModel;
+ }
+
+ /**
+ * @return the deviceName
+ */
+ public String getDeviceName() {
+ return deviceName;
+ }
+
+ /**
+ * @param deviceName the deviceName to set
+ */
+ public void setDeviceName(String deviceName) {
+ this.deviceName = deviceName;
+ }
+
+ /**
+ * @return the country
+ */
+ public String getCountry() {
+ return country;
+ }
+
+ /**
+ * @param country the country to set
+ */
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ /**
+ * @return the location
+ */
+ public String getLocation() {
+ return location;
+ }
+
+ /**
+ * @param location the location to set
+ */
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ /**
+ * @return the systemTime
+ */
+ public String getSystemTime() {
+ return systemTime;
+ }
+
+ /**
+ * @param systemTime the systemTime to set
+ */
+ public void setSystemTime(String systemTime) {
+ this.systemTime = systemTime;
+ }
+
+ /**
+ * @return the supportURL
+ */
+ public String getSupportURL() {
+ return supportURL;
+ }
+
+ /**
+ * @param supportURL the supportURL to set
+ */
+ public void setSupportURL(String supportURL) {
+ this.supportURL = supportURL;
+ }
+
+ /**
+ * @return the presentationURL
+ */
+ public String getPresentationURL() {
+ return presentationURL;
+ }
+
+ /**
+ * @param presentationURL the presentationURL to set
+ */
+ public void setPresentationURL(String presentationURL) {
+ this.presentationURL = presentationURL;
+ }
+
+ /**
+ * @return the protocol
+ */
+ public String getProtocol() {
+ return protocol;
+ }
+
+ /**
+ * @param protocol the protocol to set
+ */
+ public void setProtocol(String protocol) {
+ this.protocol = protocol;
+ }
+
+ @Override
+ public void fillFrom(MgmtObj mgmtObj) {
+ super.fillFrom(mgmtObj);
+ DeviceInfo di = (DeviceInfo) mgmtObj;
+ this.deviceLabel = di.getDeviceLabel();
+ this.deviceType = di.getDeviceType();
+ this.model = di.getModel();
+ this.manufacturer = di.getManufacturer();
+ this.fwVersion = di.getFwVersion();
+ this.swVersion = di.getSwVersion();
+ this.hwVersion = di.getHwVersion();
+ this.osVersion = di.getOsVersion();
+ this.manufacturerDetailsLink = di.getManufacturerDetailsLink();
+ this.manufacturingDate = di.getManufacturingDate();
+ this.subModel = di.getSubModel();
+ this.deviceName = di.getDeviceName();
+ this.country = di.getCountry();
+ this.location = di.getLocation();
+ this.systemTime = di.getSystemTime();
+ this.supportURL = di.getSupportURL();
+ this.presentationURL = di.getPresentationURL();
+ this.protocol = di.getProtocol();
+ }
+
+}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/DynamicAuthorizationConsultationEntity.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/DynamicAuthorizationConsultationEntity.java
index 9ec2f98..615640a 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/DynamicAuthorizationConsultationEntity.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/DynamicAuthorizationConsultationEntity.java
@@ -7,6 +7,7 @@
*******************************************************************************/
package org.eclipse.om2m.commons.entities;
+import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
@@ -22,6 +23,7 @@
import javax.persistence.ManyToOne;
import org.eclipse.om2m.commons.constants.DBEntities;
+import org.eclipse.om2m.commons.constants.MgmtDefinitionTypes;
import org.eclipse.om2m.commons.constants.ShortName;
@Entity(name = DBEntities.DYNAMIC_AUTHORIZATION_CONSULTATION_ENTITY)
@@ -171,7 +173,15 @@
inverseJoinColumns = { @JoinColumn(name = DBEntities.ANI_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) }
)
private List<AreaNwkInfoEntity> linkedAreaNwkInfoEntities;
-
+
+ @ManyToMany(fetch=FetchType.LAZY)
+ @JoinTable(
+ name = DBEntities.DVI_DAC_JOIN,
+ joinColumns = { @JoinColumn(name = DBEntities.DAC_JOINID, referencedColumnName = ShortName.RESOURCE_ID) },
+ inverseJoinColumns = { @JoinColumn(name = DBEntities.DVI_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) }
+ )
+ private List<DeviceInfoEntity> linkedDeviceInfoEntities;
+
@ManyToMany(fetch=FetchType.LAZY)
@JoinTable(
name = DBEntities.NOD_DAC_JOIN,
@@ -414,6 +424,48 @@
}
/**
+ * @return the linkedAreaNwkInfoEntities
+ */
+ public List<AreaNwkInfoEntity> getLinkedAreaNwkInfoEntities() {
+ if(linkedAreaNwkInfoEntities == null) {
+ linkedAreaNwkInfoEntities = new ArrayList<>();
+ }
+ return linkedAreaNwkInfoEntities;
+ }
+
+ /**
+ * @param linkedAreaNwkInfoEntities the linkedAreaNwkInfoEntities to set
+ */
+ public void setLinkedAreaNwkInfoEntities(List<AreaNwkInfoEntity> linkedAreaNwkInfoEntities) {
+ this.linkedAreaNwkInfoEntities = linkedAreaNwkInfoEntities;
+ }
+
+ /**
+ * @return the linkedMgmtObjEntities
+ */
+ public List<DeviceInfoEntity> getLinkedDeviceInfoEntities() {
+ if (linkedDeviceInfoEntities == null) {
+ linkedDeviceInfoEntities = new ArrayList<>();
+ }
+ return linkedDeviceInfoEntities;
+ }
+
+ /**
+ * @param linkedMgmtObjEntities the linkedMgmtObjEntities to set
+ */
+ public void setLinkedDeviceInfoEntities(List<DeviceInfoEntity> linkedMgmtObjEntities) {
+ this.linkedDeviceInfoEntities = linkedMgmtObjEntities;
+ }
+
+ public List<MgmtObjEntity> getMgmtObjEntities() {
+ List<MgmtObjEntity> ret = new ArrayList<MgmtObjEntity>();
+ ret.addAll(getLinkedAreaNwkInfoEntities());
+ ret.addAll(getLinkedAreaNwkDeviceInfoEntities());
+ ret.addAll(getLinkedDeviceInfoEntities());
+ return ret;
+ }
+
+ /**
* @return the linkedNodeEntities
*/
public List<NodeEntity> getLinkedNodeEntities() {
@@ -499,23 +551,6 @@
}
/**
- * @return the linkedAreaNwkInfoEntities
- */
- public List<AreaNwkInfoEntity> getLinkedAreaNwkInfoEntities() {
- if(linkedAreaNwkInfoEntities == null) {
- linkedAreaNwkInfoEntities = new ArrayList<>();
- }
- return linkedAreaNwkInfoEntities;
- }
-
- /**
- * @param linkedAreaNwkInfoEntities the linkedAreaNwkInfoEntities to set
- */
- public void setLinkedAreaNwkInfoEntities(List<AreaNwkInfoEntity> linkedAreaNwkInfoEntities) {
- this.linkedAreaNwkInfoEntities = linkedAreaNwkInfoEntities;
- }
-
- /**
* @return the linkedCseBaseEntities
*/
public List<CSEBaseEntity> getLinkedCseBaseEntities() {
@@ -531,7 +566,25 @@
public void setLinkedCseBaseEntities(List<CSEBaseEntity> linkedCseBaseEntities) {
this.linkedCseBaseEntities = linkedCseBaseEntities;
}
-
-
+
+ public void addMgmtObj(MgmtObjEntity mgmtObjEntity) {
+ BigInteger mgmtDef = mgmtObjEntity.getMgmtDefinition();
+ if (mgmtDef.equals(MgmtDefinitionTypes.AREA_NWK_INFO))
+ getLinkedAreaNwkInfoEntities().add((AreaNwkInfoEntity) mgmtObjEntity);
+ else if (mgmtDef.equals(MgmtDefinitionTypes.AREA_NWK_DEVICE_INFO))
+ getLinkedAreaNwkDeviceInfoEntities().add((AreaNwkDeviceInfoEntity) mgmtObjEntity);
+ else if (mgmtDef.equals(MgmtDefinitionTypes.DEVICE_INFO))
+ getLinkedDeviceInfoEntities().add((DeviceInfoEntity) mgmtObjEntity);
+ }
+
+ public void removeMgmtObj(MgmtObjEntity mgmtObjEntity) {
+ BigInteger mgmtDef = mgmtObjEntity.getMgmtDefinition();
+ if (mgmtDef.equals(MgmtDefinitionTypes.AREA_NWK_INFO))
+ getLinkedAreaNwkInfoEntities().remove((AreaNwkInfoEntity) mgmtObjEntity);
+ else if (mgmtDef.equals(MgmtDefinitionTypes.AREA_NWK_DEVICE_INFO))
+ getLinkedAreaNwkDeviceInfoEntities().remove((AreaNwkDeviceInfoEntity) mgmtObjEntity);
+ else if (mgmtDef.equals(MgmtDefinitionTypes.DEVICE_INFO))
+ getLinkedDeviceInfoEntities().remove((DeviceInfoEntity) mgmtObjEntity);
+ }
}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/FlexContainerAnncEntity.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/FlexContainerAnncEntity.java
index 1dac7af..fcc9dcb 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/FlexContainerAnncEntity.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/FlexContainerAnncEntity.java
@@ -11,7 +11,6 @@
import java.util.ArrayList;
import java.util.List;
-import javax.persistence.AssociationOverride;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/FlexContainerEntity.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/FlexContainerEntity.java
index 75ec989..50e7d97 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/FlexContainerEntity.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/FlexContainerEntity.java
@@ -58,6 +58,8 @@
protected String ontologyRef;
@Column(name=ShortName.CONTAINER_DEFINITION)
protected String containerDefinition;
+ @Column(name=ShortName.NODE_LINK)
+ protected String nodeLink;
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
@JoinTable(
@@ -363,6 +365,14 @@
this.parentCSR = parentCSR;
}
+ public String getNodeLink() {
+ return nodeLink;
+ }
+
+ public void setNodeLink(String nodeLink) {
+ this.nodeLink = nodeLink;
+ }
+
/**
* @return the subscriptions
*/
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/LabelEntity.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/LabelEntity.java
index 6cee036..6bbb6db 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/LabelEntity.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/LabelEntity.java
@@ -19,6 +19,7 @@
*******************************************************************************/
package org.eclipse.om2m.commons.entities;
+import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
@@ -28,6 +29,7 @@
import javax.persistence.ManyToMany;
import org.eclipse.om2m.commons.constants.DBEntities;
+import org.eclipse.om2m.commons.constants.MgmtDefinitionTypes;
import org.eclipse.om2m.commons.constants.ShortName;
/**
@@ -88,6 +90,9 @@
@ManyToMany(targetEntity = AreaNwkDeviceInfoEntity.class, mappedBy = "labelsEntities")
protected List<AreaNwkDeviceInfoEntity> linkedAndi;
+ @ManyToMany(targetEntity = DeviceInfoEntity.class, mappedBy = "labelsEntities")
+ protected List<DeviceInfoEntity> linkedDvi;
+
/**
* @return the linkedSub
*/
@@ -372,6 +377,33 @@
this.linkedAndi = linkedAndi;
}
+ /**
+ * @return the linkedDvi
+ */
+ public List<DeviceInfoEntity> getLinkedDvi() {
+ if (this.linkedDvi == null) {
+ this.linkedDvi = new ArrayList<>();
+ }
+ return linkedDvi;
+ }
+
+ /**
+ * @param linkedDvi the linkedDvi to set
+ */
+ public void setLinkedDvi(List<DeviceInfoEntity> linkedDvi) {
+ this.linkedDvi = linkedDvi;
+ }
+
+ public void addMgmtObj(MgmtObjEntity mgmtObjEntity) {
+ BigInteger mgmtDef = mgmtObjEntity.getMgmtDefinition();
+ if (mgmtDef.equals(MgmtDefinitionTypes.AREA_NWK_INFO))
+ getLinkedAni().add((AreaNwkInfoEntity) mgmtObjEntity);
+ else if (mgmtDef.equals(MgmtDefinitionTypes.AREA_NWK_DEVICE_INFO))
+ getLinkedAndi().add((AreaNwkDeviceInfoEntity) mgmtObjEntity);
+ else if (mgmtDef.equals(MgmtDefinitionTypes.DEVICE_INFO))
+ getLinkedDvi().add((DeviceInfoEntity) mgmtObjEntity);
+ }
+
@Override
public boolean equals(Object obj) {
if (this == obj){
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/MgmtObjAnncEntity.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/MgmtObjAnncEntity.java
new file mode 100644
index 0000000..e1a4c81
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/MgmtObjAnncEntity.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2013-2016 LAAS-CNRS (www.laas.fr)
+ * 7 Colonel Roche 31077 Toulouse - France
+ *
+ * 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
+ *
+ * Initial Contributors:
+ * Thierry Monteil : Project manager, technical co-manager
+ * Mahdi Ben Alaya : Technical co-manager
+ * Samir Medjiah : Technical co-manager
+ * Khalil Drira : Strategy expert
+ * Guillaume Garzone : Developer
+ * François Aïssaoui : Developer
+ *
+ * New contributors :
+ *******************************************************************************/
+package org.eclipse.om2m.commons.entities;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.Column;
+import javax.persistence.MappedSuperclass;
+
+import org.eclipse.om2m.commons.constants.MgmtDefinitionTypes;
+import org.eclipse.om2m.commons.constants.ShortName;
+import org.eclipse.om2m.commons.exceptions.BadRequestException;
+import org.eclipse.om2m.commons.resource.AnnouncedMgmtResource;
+import org.eclipse.om2m.commons.resource.MgmtObj;
+
+/**
+ * Generic common attributes for management objects entities
+ *
+ */
+@MappedSuperclass
+public abstract class MgmtObjAnncEntity extends AnnouncedResourceEntity {
+
+ @Column (name = ShortName.MGMT_DEF)
+ protected BigInteger mgmtDefinition;
+
+ @Column(name = ShortName.OBJ_IDS)
+ protected List<String> objectIDs;
+
+ @Column(name = ShortName.OBJ_PATHS)
+ protected List<String> objectPaths;
+
+ @Column(name = ShortName.DESCRIPTION)
+ protected String description;
+
+
+ /**
+ * @return the mgmtDefinition
+ */
+ public BigInteger getMgmtDefinition() {
+ return mgmtDefinition;
+ }
+
+ /**
+ * @return the objectIDs
+ */
+ public List<String> getObjectIDs() {
+ if (this.objectIDs == null) {
+ this.objectIDs = new ArrayList<>();
+ }
+ return objectIDs;
+ }
+
+ /**
+ * @param objectIDs the objectIDs to set
+ */
+ public void setObjectIDs(List<String> objectIDs) {
+ this.objectIDs = objectIDs;
+ }
+
+ /**
+ * @return the objectPaths
+ */
+ public List<String> getObjectPaths() {
+ if (this.objectPaths == null) {
+ this.objectPaths = new ArrayList<>();
+ }
+ return objectPaths;
+ }
+
+ /**
+ * @param objectPaths the objectPaths to set
+ */
+ public void setObjectPaths(List<String> objectPaths) {
+ this.objectPaths = objectPaths;
+ }
+
+ /**
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @param description the description to set
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * @param mgmtDefinition the mgmtDefinition to set
+ */
+ public void setMgmtDefinition(BigInteger mgmtDefinition) {
+ this.mgmtDefinition = mgmtDefinition;
+ }
+
+ public void fillFrom(AnnouncedMgmtResource mgmtObj) {
+ this.mgmtDefinition = mgmtObj.getMgmtDefinition();
+ this.description = mgmtObj.getDescription();
+ this.objectIDs = mgmtObj.getObjectIDs();
+ this.objectPaths = mgmtObj.getObjectPaths();
+ }
+
+ public static MgmtObjAnncEntity create(BigInteger mgmtDef) {
+ // TODO
+// if (mgmtDef.equals(MgmtDefinitionTypes.AREA_NWK_INFO))
+// return new AreaNwkInfoEntity();
+// if (mgmtDef.equals(MgmtDefinitionTypes.AREA_NWK_DEVICE_INFO))
+// return new AreaNwkDeviceInfoEntity();
+// if (mgmtDef.equals(MgmtDefinitionTypes.DEVICE_INFO))
+// return new DeviceInfoEntity();
+ throw new BadRequestException("Not implemented");
+ }
+
+ abstract public NodeEntity getParentNode();
+ abstract public void setParentNode(NodeEntity parentNode);
+ abstract public List<AccessControlPolicyEntity> getAccessControlPolicies();
+ abstract public List<SubscriptionEntity> getSubscriptions();
+
+}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/MgmtObjEntity.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/MgmtObjEntity.java
index 13e2c4e..a075180 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/MgmtObjEntity.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/MgmtObjEntity.java
@@ -24,15 +24,12 @@
import java.util.List;
import javax.persistence.Column;
-import javax.persistence.FetchType;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
import javax.persistence.MappedSuperclass;
-import javax.persistence.OneToMany;
-import org.eclipse.om2m.commons.constants.DBEntities;
+import org.eclipse.om2m.commons.constants.MgmtDefinitionTypes;
import org.eclipse.om2m.commons.constants.ShortName;
+import org.eclipse.om2m.commons.exceptions.BadRequestException;
+import org.eclipse.om2m.commons.resource.MgmtObj;
/**
* Generic common attributes for management objects entities
@@ -43,13 +40,16 @@
@Column (name = ShortName.MGMT_DEF)
protected BigInteger mgmtDefinition;
+
@Column(name = ShortName.OBJ_IDS)
protected List<String> objectIDs;
+
@Column(name = ShortName.OBJ_PATHS)
protected List<String> objectPaths;
+
@Column(name = ShortName.DESCRIPTION)
protected String description;
-
+
/**
* @return the mgmtDefinition
@@ -57,6 +57,7 @@
public BigInteger getMgmtDefinition() {
return mgmtDefinition;
}
+
/**
* @return the objectIDs
*/
@@ -66,12 +67,14 @@
}
return objectIDs;
}
+
/**
* @param objectIDs the objectIDs to set
*/
public void setObjectIDs(List<String> objectIDs) {
this.objectIDs = objectIDs;
}
+
/**
* @return the objectPaths
*/
@@ -81,24 +84,28 @@
}
return objectPaths;
}
+
/**
* @param objectPaths the objectPaths to set
*/
public void setObjectPaths(List<String> objectPaths) {
this.objectPaths = objectPaths;
}
+
/**
* @return the description
*/
public String getDescription() {
return description;
}
+
/**
* @param description the description to set
*/
public void setDescription(String description) {
this.description = description;
}
+
/**
* @param mgmtDefinition the mgmtDefinition to set
*/
@@ -106,4 +113,26 @@
this.mgmtDefinition = mgmtDefinition;
}
+ public void fillFrom(MgmtObj mgmtObj) {
+ this.mgmtDefinition = mgmtObj.getMgmtDefinition();
+ this.description = mgmtObj.getDescription();
+ this.objectIDs = mgmtObj.getObjectIDs();
+ this.objectPaths = mgmtObj.getObjectPaths();
+ }
+
+ public static MgmtObjEntity create(BigInteger mgmtDef) {
+ if (mgmtDef.equals(MgmtDefinitionTypes.AREA_NWK_INFO))
+ return new AreaNwkInfoEntity();
+ if (mgmtDef.equals(MgmtDefinitionTypes.AREA_NWK_DEVICE_INFO))
+ return new AreaNwkDeviceInfoEntity();
+ if (mgmtDef.equals(MgmtDefinitionTypes.DEVICE_INFO))
+ return new DeviceInfoEntity();
+ throw new BadRequestException("Not implemented");
+ }
+
+ abstract public NodeEntity getParentNode();
+ abstract public void setParentNode(NodeEntity parentNode);
+ abstract public List<AccessControlPolicyEntity> getAccessControlPolicies();
+ abstract public List<SubscriptionEntity> getSubscriptions();
+
}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/NodeEntity.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/NodeEntity.java
index 446c4d2..fff23af 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/NodeEntity.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/NodeEntity.java
@@ -19,6 +19,7 @@
*******************************************************************************/
package org.eclipse.om2m.commons.entities;
+import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
@@ -35,6 +36,7 @@
import javax.persistence.OneToMany;
import org.eclipse.om2m.commons.constants.DBEntities;
+import org.eclipse.om2m.commons.constants.MgmtDefinitionTypes;
import org.eclipse.om2m.commons.constants.ShortName;
@Inheritance(strategy = InheritanceType.JOINED)
@@ -44,7 +46,7 @@
// linked ACP
@ManyToMany(fetch=FetchType.LAZY)
@JoinTable(
- name = DBEntities.ACPNOD_JOIN,
+ name = DBEntities.ACP_NOD_JOIN,
joinColumns = { @JoinColumn(name = DBEntities.NOD_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) },
inverseJoinColumns = { @JoinColumn(name = DBEntities.ACP_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) }
)
@@ -62,13 +64,18 @@
// node id
@Column(name = ShortName.NODE_ID)
protected String nodeID;
+
// hosted CSE LINK
@Column(name = ShortName.HOSTED_CSE_LINK)
protected String hostedCSELink;
+ // hosted APP LINK
+ @Column(name = ShortName.HOSTED_APP_LINK)
+ protected String hostedAppLink;
+
@ManyToOne(fetch = FetchType.LAZY)
@JoinTable(
- name = DBEntities.CSBNOD_CH_JOIN,
+ name = DBEntities.CSB_NOD_CH_JOIN,
joinColumns = { @JoinColumn(name = DBEntities.NOD_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) },
inverseJoinColumns = { @JoinColumn(name = DBEntities.CSEB_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) }
)
@@ -76,7 +83,7 @@
@ManyToOne(fetch = FetchType.LAZY)
@JoinTable(
- name = DBEntities.CSRNOD_CH_JOIN,
+ name = DBEntities.CSR_NOD_CH_JOIN,
joinColumns = { @JoinColumn(name = DBEntities.NOD_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) },
inverseJoinColumns = { @JoinColumn(name = DBEntities.CSR_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) }
)
@@ -84,29 +91,38 @@
@OneToMany(fetch = FetchType.LAZY, cascade = {CascadeType.ALL})
@JoinTable(
- name = DBEntities.NODSUB_JOIN,
+ name = DBEntities.NOD_SUB_JOIN,
joinColumns = { @JoinColumn(name = DBEntities.NOD_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) },
inverseJoinColumns = { @JoinColumn(name = DBEntities.SUB_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) }
)
- protected List<SubscriptionEntity> childSubscriptions;
+ protected List<SubscriptionEntity> subscriptions;
// Database link to AreaNwkInfo Entity
- @OneToMany(fetch = FetchType.LAZY, cascade = {CascadeType.ALL})
+ @OneToMany(fetch = FetchType.LAZY, cascade = {CascadeType.ALL}, mappedBy="parentNode")
@JoinTable(
- name = DBEntities.ANINOD_JOIN,
+ name = DBEntities.ANI_NOD_JOIN,
inverseJoinColumns = { @JoinColumn(name = DBEntities.ANI_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) },
joinColumns = { @JoinColumn(name = DBEntities.NOD_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) }
)
protected List<AreaNwkInfoEntity> childAreaNwkInfoEntities;
// Database link to AreaNwkDeviceInfo entity
- @OneToMany(fetch = FetchType.LAZY, cascade = {CascadeType.ALL})
+ @OneToMany(fetch = FetchType.LAZY, cascade = {CascadeType.ALL}, mappedBy="parentNode")
@JoinTable(
- name = DBEntities.ANDINOD_JOIN,
+ name = DBEntities.ANDI_NOD_JOIN,
inverseJoinColumns = { @JoinColumn(name = DBEntities.ANDI_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) },
joinColumns = { @JoinColumn(name = DBEntities.NOD_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) }
)
protected List<AreaNwkDeviceInfoEntity> childAreaNwkDeviceInfoEntities;
+
+ // Database link to DeviceInfo entity
+ @OneToMany(fetch = FetchType.LAZY, cascade = {CascadeType.ALL})
+ @JoinTable(
+ name = DBEntities.DVI_NOD_JOIN,
+ inverseJoinColumns = { @JoinColumn(name = DBEntities.DVI_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) },
+ joinColumns = { @JoinColumn(name = DBEntities.NOD_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) }
+ )
+ protected List<DeviceInfoEntity> childDeviceInfoEntities;
/**
* @return the accessControlPolicies
@@ -117,6 +133,7 @@
}
return linkedAcps;
}
+
/**
* @param accessControlPolicies the accessControlPolicies to set
*/
@@ -124,66 +141,91 @@
List<AccessControlPolicyEntity> accessControlPolicies) {
this.linkedAcps = accessControlPolicies;
}
+
/**
* @return the nodeID
*/
public String getNodeID() {
return nodeID;
}
+
/**
* @param nodeID the nodeID to set
*/
public void setNodeID(String nodeID) {
this.nodeID = nodeID;
}
+
/**
* @return the hostedCSELink
*/
public String getHostedCSELink() {
return hostedCSELink;
}
+
/**
* @param hostedCSELink the hostedCSELink to set
*/
public void setHostedCSELink(String hostedCSELink) {
this.hostedCSELink = hostedCSELink;
}
+
+ /**
+ * @return the hostedAppLink
+ */
+ public String getHostedAppLink() {
+ return hostedAppLink;
+ }
+
+ /**
+ * @param hostedCSELink the hostedAppLink to set
+ */
+ public void setHostedAppLink(String hostedAppLink) {
+ this.hostedAppLink = hostedAppLink;
+ }
+
/**
* @return the parentCsb
*/
public CSEBaseEntity getParentCsb() {
return parentCsb;
}
+
/**
* @param parentCsb the parentCsb to set
*/
public void setParentCsb(CSEBaseEntity parentCsb) {
this.parentCsb = parentCsb;
}
+
/**
* @return the parentCsr
*/
public CSEBaseEntity getParentCsr() {
return parentCsr;
}
+
/**
* @param parentCsr the parentCsr to set
*/
public void setParentCsr(CSEBaseEntity parentCsr) {
this.parentCsr = parentCsr;
}
+
/**
* @return the childSubscriptions
*/
- public List<SubscriptionEntity> getChildSubscriptions() {
- return childSubscriptions;
+ public List<SubscriptionEntity> getSubscriptions() {
+ return subscriptions;
}
+
/**
* @param childSubscriptions the childSubscriptions to set
*/
- public void setChildSubscriptions(List<SubscriptionEntity> childSubscriptions) {
- this.childSubscriptions = childSubscriptions;
+ public void setSubscriptions(List<SubscriptionEntity> subscriptions) {
+ this.subscriptions = subscriptions;
}
+
/**
* @return the childAreaNwkInfoEntities
*/
@@ -193,27 +235,56 @@
}
return childAreaNwkInfoEntities;
}
+
/**
* @param childAreaNwkInfoEntities the childAreaNwkInfoEntities to set
*/
- public void setChildAreaNwkInfoEntities(
- List<AreaNwkInfoEntity> childAreaNwkInfoEntities) {
+ public void setChildAreaNwkInfoEntities(List<AreaNwkInfoEntity> childAreaNwkInfoEntities) {
this.childAreaNwkInfoEntities = childAreaNwkInfoEntities;
}
+
/**
* @return the childAreaNwkDeviceInfoEntities
*/
public List<AreaNwkDeviceInfoEntity> getChildAreaNwkDeviceInfoEntities() {
+ if (this.childAreaNwkDeviceInfoEntities == null) {
+ this.childAreaNwkDeviceInfoEntities = new ArrayList<>();
+ }
return childAreaNwkDeviceInfoEntities;
}
+
/**
* @param childAreaNwkDeviceInfoEntities the childAreaNwkDeviceInfoEntities to set
*/
- public void setChildAreaNwkDeviceInfoEntities(
- List<AreaNwkDeviceInfoEntity> childAreaNwkDeviceInfoEntities) {
+ public void setChildAreaNwkDeviceInfoEntities(List<AreaNwkDeviceInfoEntity> childAreaNwkDeviceInfoEntities) {
this.childAreaNwkDeviceInfoEntities = childAreaNwkDeviceInfoEntities;
}
+ /**
+ * @return the childDeviceInfoEntities
+ */
+ public List<DeviceInfoEntity> getChildDeviceInfoEntities() {
+ if (this.childDeviceInfoEntities == null) {
+ this.childDeviceInfoEntities = new ArrayList<>();
+ }
+ return childDeviceInfoEntities;
+ }
+
+ /**
+ * @param childDeviceInfoEntities the childDeviceInfoEntities to set
+ */
+ public void setChildDeviceInfoEntities(List<DeviceInfoEntity> childDeviceInfoEntities) {
+ this.childDeviceInfoEntities = childDeviceInfoEntities;
+ }
+
+ public List<MgmtObjEntity> getMgmtObjEntities() {
+ List<MgmtObjEntity> ret = new ArrayList<MgmtObjEntity>();
+ ret.addAll(getChildAreaNwkInfoEntities());
+ ret.addAll(getChildAreaNwkDeviceInfoEntities());
+ ret.addAll(getChildDeviceInfoEntities());
+ return ret;
+ }
+
@Override
/**
* Retrieve linked dynamicAuthorizationConsultations
@@ -233,4 +304,24 @@
this.dynamicAuthorizationConsultations = list;
}
+ public void addMgmtObj(MgmtObjEntity mgmtObj) {
+ BigInteger mgmtDef = mgmtObj.getMgmtDefinition();
+ if (mgmtDef.equals(MgmtDefinitionTypes.AREA_NWK_INFO))
+ getChildAreaNwkInfoEntities().add((AreaNwkInfoEntity) mgmtObj);
+ else if (mgmtDef.equals(MgmtDefinitionTypes.AREA_NWK_DEVICE_INFO))
+ getChildAreaNwkDeviceInfoEntities().add((AreaNwkDeviceInfoEntity) mgmtObj);
+ else if (mgmtDef.equals(MgmtDefinitionTypes.DEVICE_INFO))
+ getChildDeviceInfoEntities().add((DeviceInfoEntity) mgmtObj);
+ }
+
+ public void removeMgmtObj(MgmtObjEntity mgmtObj) {
+ BigInteger mgmtDef = mgmtObj.getMgmtDefinition();
+ if (mgmtDef.equals(MgmtDefinitionTypes.AREA_NWK_INFO))
+ getChildAreaNwkInfoEntities().remove((AreaNwkInfoEntity) mgmtObj);
+ else if (mgmtDef.equals(MgmtDefinitionTypes.AREA_NWK_DEVICE_INFO))
+ getChildAreaNwkDeviceInfoEntities().remove((AreaNwkDeviceInfoEntity) mgmtObj);
+ else if (mgmtDef.equals(MgmtDefinitionTypes.DEVICE_INFO))
+ getChildDeviceInfoEntities().remove((DeviceInfoEntity) mgmtObj);
+ }
+
}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/RemoteCSEEntity.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/RemoteCSEEntity.java
index 3aa9de1..7596093 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/RemoteCSEEntity.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/RemoteCSEEntity.java
@@ -177,7 +177,7 @@
/** List of Nodes */
@OneToMany(fetch=FetchType.LAZY, cascade={CascadeType.ALL})
@JoinTable(
- name=DBEntities.CSRNOD_CH_JOIN,
+ name=DBEntities.CSR_NOD_CH_JOIN,
joinColumns={@JoinColumn(name=DBEntities.CSR_JOIN_ID, referencedColumnName=ShortName.RESOURCE_ID)},
inverseJoinColumns={@JoinColumn(name=DBEntities.NOD_JOIN_ID, referencedColumnName=ShortName.RESOURCE_ID)}
)
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/SubscriptionEntity.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/SubscriptionEntity.java
index f82c702..aecfd74 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/SubscriptionEntity.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/SubscriptionEntity.java
@@ -170,7 +170,7 @@
@ManyToOne(targetEntity = NodeEntity.class, fetch = FetchType.LAZY)
@JoinTable(
- name = DBEntities.NODSUB_JOIN,
+ name = DBEntities.NOD_SUB_JOIN,
inverseJoinColumns = { @JoinColumn(name = DBEntities.NOD_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) },
joinColumns = { @JoinColumn(name = DBEntities.SUB_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) }
)
@@ -180,7 +180,7 @@
// Database link to Subscriptions
@ManyToOne(fetch = FetchType.LAZY, targetEntity = AreaNwkInfoEntity.class)
@JoinTable(
- name = DBEntities.ANISUB_JOIN,
+ name = DBEntities.ANI_SUB_JOIN,
inverseJoinColumns = { @JoinColumn(name = DBEntities.ANI_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) },
joinColumns = { @JoinColumn(name = DBEntities.SUB_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) }
)
@@ -188,12 +188,20 @@
@ManyToOne(fetch = FetchType.LAZY, targetEntity = AreaNwkDeviceInfoEntity.class)
@JoinTable(
- name = DBEntities.ANDISUB_JOIN,
+ name = DBEntities.ANDI_SUB_JOIN,
inverseJoinColumns = { @JoinColumn(name = DBEntities.ANDI_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) },
joinColumns = { @JoinColumn(name = DBEntities.SUB_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) }
)
protected AreaNwkDeviceInfoEntity parentAndi;
+ @ManyToOne(fetch = FetchType.LAZY, targetEntity = DeviceInfoEntity.class)
+ @JoinTable(
+ name = DBEntities.DVI_SUB_JOIN,
+ inverseJoinColumns = { @JoinColumn(name = DBEntities.DVI_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) },
+ joinColumns = { @JoinColumn(name = DBEntities.SUB_JOIN_ID, referencedColumnName = ShortName.RESOURCE_ID) }
+ )
+ protected DeviceInfoEntity parentDvi;
+
// link to schedule entity
@OneToOne(cascade = {CascadeType.ALL}, fetch = FetchType.LAZY, targetEntity = ScheduleEntity.class)
@JoinColumn(name = "sch_id")
@@ -511,6 +519,20 @@
public void setParentAndi(AreaNwkDeviceInfoEntity parentAndi) {
this.parentAndi = parentAndi;
}
+
+ /**
+ * @return the parentDvi
+ */
+ public DeviceInfoEntity getParentDvi() {
+ return parentDvi;
+ }
+
+ /**
+ * @param parentDvi the parentDvi to set
+ */
+ public void setParentDvi(DeviceInfoEntity parentDvi) {
+ this.parentDvi = parentDvi;
+ }
/**
* @return the linkedSchedule
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AbstractFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AbstractFlexContainer.java
index 3f9e1f2..14e02d8 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AbstractFlexContainer.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AbstractFlexContainer.java
@@ -64,36 +64,6 @@
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlSeeAlso({DeviceLightFlexContainer.class,
- DeviceSmartElectricMeterFlexContainer.class, DeviceWaterHeaterFlexContainer.class,
- DeviceCameraFlexContainer.class, DeviceCoffeeMachineFlexContainer.class,
- DeviceContactDetectorFlexContainer.class, DeviceDoorFlexContainer.class,
- DeviceFloodDetectorFlexContainer.class, DeviceGasValveFlexContainer.class,
- DeviceMotionDetectorFlexContainer.class, DeviceSmokeDetectorFlexContainer.class,
- DeviceSmokeExtractorFlexContainer.class, DeviceSwitchButtonFlexContainer.class,
- DeviceTemperatureDetectorFlexContainer.class, DeviceThermostatFlexContainer.class,
- DeviceWarningDeviceFlexContainer.class,
- DeviceWaterValveFlexContainer.class, DeviceWeatherStationFlexContainer.class,
- DeviceThermostatFlexContainer.class,
- AlarmSpeakerFlexContainer.class, AudioVolumeFlexContainer.class,
- BinarySwitchFlexContainer.class, BoilerFlexContainer.class,
- BrightnessFlexContainer.class, ClockFlexContainer.class,
- ColourFlexContainer.class, ColourSaturationFlexContainer.class,
- DoorStatusFlexContainer.class, EnergyConsumptionFlexContainer.class,
- EnergyGenerationFlexContainer.class, FaultDetectionFlexContainer.class,
- RelativeHumidityFlexContainer.class, RunModeFlexContainer.class,
- SmokeSensorFlexContainer.class, TemperatureFlexContainer.class,
- WaterLevelFlexContainer.class, WaterSensorFlexContainer.class,
- AtmosphericPressureSensorFlexContainer.class, BrewingFlexContainer.class,
- ContactSensorFlexContainer.class, ExtendedCarbonDioxideSensorFlexContainer.class,
- FoamingFlexContainer.class, GrinderFlexContainer.class,
- NoiseFlexContainer.class, PersonSensorFlexContainer.class,
- StreamingFlexContainer.class, LockFlexContainer.class,
- BatteryFlexContainer.class,
- LiquidLevelFlexContainer.class, TimerFlexContainer.class,
- ToggleFlexContainer.class, DeviceNumberDeviceFlexContainer.class, NumberValueFlexContainer.class,
- DecrementNumberValueFlexContainer.class, IncrementNumberValueFlexContainer.class,
- ResetNumberValueFlexContainer.class})
public abstract class AbstractFlexContainer extends AnnounceableResource {
@XmlTransient
@@ -105,16 +75,25 @@
@XmlElement(name = ShortName.STATETAG, required = true, namespace="")
@XmlSchemaType(name = "nonNegativeInteger")
protected BigInteger stateTag;
+
@XmlElement(name = ShortName.CREATOR, required = false, namespace="")
protected String creator;
+
@XmlSchemaType(name = "anyURI")
@XmlElement(name = ShortName.ONTOLOGY_REF, required = false, namespace="")
protected String ontologyRef;
+
@XmlSchemaType(name="anyURI")
- @XmlElement(name = ShortName.CONTAINER_DEFINITION, required=true, namespace="")
+ @XmlElement(name = ShortName.CONTAINER_DEFINITION, required = true, namespace="")
protected String containerDefinition;
+
+ @XmlSchemaType(name = "anyURI")
+ @XmlElement(name = ShortName.NODE_LINK, required = false, namespace="")
+ protected String nodeLink;
+
@XmlElement(name = ShortName.CHILD_RESOURCE, namespace="")
protected List<ChildResourceRef> childResource;
+
@XmlElements({
// @XmlElement(name = ShortName.CNT, namespace = "http://www.onem2m.org/xml/protocols", type = Container.class),
// @XmlElement(name = ShortName.FCNT, namespace = "http://www.onem2m.org/xml/protocols", type = AbstractFlexContainer.class),
@@ -321,6 +300,27 @@
}
/**
+ * Gets the value of the nodeLink property.
+ *
+ * @return possible object is {@link String }
+ *
+ */
+ public String getNodeLink() {
+ return nodeLink;
+ }
+
+ /**
+ * Sets the value of the nodeLink property.
+ *
+ * @param value
+ * allowed object is {@link String }
+ *
+ */
+ public void setNodeLink(String value) {
+ this.nodeLink = value;
+ }
+
+ /**
* Gets the value of the childResource property.
*
* <p>
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AbstractFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AbstractFlexContainerAnnc.java
index 96dc4aa..2f2d7ad 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AbstractFlexContainerAnnc.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AbstractFlexContainerAnnc.java
@@ -17,97 +17,11 @@
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlSchemaType;
-import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlTransient;
import org.eclipse.om2m.commons.constants.ShortName;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.AlarmSpeakerFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.AtmosphericPressureSensorFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.AudioVolumeFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.BatteryFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.BinarySwitchFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.BoilerFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.BrewingFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.BrightnessFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.ClockFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.ColourFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.ColourSaturationFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.ContactSensorFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.DecrementNumberValueFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceCameraFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceCoffeeMachineFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceContactDetectorFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceDoorFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceFloodDetectorFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceGasValveFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceLightFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceMotionDetectorFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceNumberDeviceFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceSmartElectricMeterFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceSmokeDetectorFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceSmokeExtractorFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceSwitchButtonFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceTemperatureDetectorFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceThermostatFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceWarningDeviceFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceWaterHeaterFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceWaterValveFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceWeatherStationFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.DoorStatusFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.EnergyConsumptionFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.EnergyGenerationFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.ExtendedCarbonDioxideSensorFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.FaultDetectionFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.FoamingFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.GrinderFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.IncrementNumberValueFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.LiquidLevelFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.LockFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.NoiseFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.NumberValueFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.PersonSensorFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.RelativeHumidityFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.ResetNumberValueFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.RunModeFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.SmokeSensorFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.StreamingFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.TemperatureFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.TimerFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.ToggleFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.WaterLevelFlexContainerAnnc;
-import org.eclipse.om2m.commons.resource.flexcontainerspec.WaterSensorFlexContainerAnnc;
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlSeeAlso({DeviceLightFlexContainerAnnc.class,
- DeviceSmartElectricMeterFlexContainerAnnc.class, DeviceWaterHeaterFlexContainerAnnc.class,
- DeviceCameraFlexContainerAnnc.class, DeviceCoffeeMachineFlexContainerAnnc.class,
- DeviceContactDetectorFlexContainerAnnc.class, DeviceDoorFlexContainerAnnc.class,
- DeviceFloodDetectorFlexContainerAnnc.class, DeviceGasValveFlexContainerAnnc.class,
- DeviceMotionDetectorFlexContainerAnnc.class, DeviceSmokeDetectorFlexContainerAnnc.class,
- DeviceSmokeExtractorFlexContainerAnnc.class, DeviceSwitchButtonFlexContainerAnnc.class,
- DeviceTemperatureDetectorFlexContainerAnnc.class, DeviceThermostatFlexContainerAnnc.class,
- DeviceWarningDeviceFlexContainerAnnc.class,
- DeviceWaterValveFlexContainerAnnc.class, DeviceWeatherStationFlexContainerAnnc.class,
- DeviceThermostatFlexContainerAnnc.class, DeviceNumberDeviceFlexContainerAnnc.class,
- AlarmSpeakerFlexContainerAnnc.class, AudioVolumeFlexContainerAnnc.class,
- BinarySwitchFlexContainerAnnc.class, BoilerFlexContainerAnnc.class,
- BrightnessFlexContainerAnnc.class, ClockFlexContainerAnnc.class,
- ColourFlexContainerAnnc.class, ColourSaturationFlexContainerAnnc.class,
- DoorStatusFlexContainerAnnc.class, EnergyConsumptionFlexContainerAnnc.class,
- EnergyGenerationFlexContainerAnnc.class, FaultDetectionFlexContainerAnnc.class,
- RelativeHumidityFlexContainerAnnc.class, RunModeFlexContainerAnnc.class,
- SmokeSensorFlexContainerAnnc.class, TemperatureFlexContainerAnnc.class,
- WaterLevelFlexContainerAnnc.class, WaterSensorFlexContainerAnnc.class,
- AtmosphericPressureSensorFlexContainerAnnc.class, BrewingFlexContainerAnnc.class,
- ContactSensorFlexContainerAnnc.class, ExtendedCarbonDioxideSensorFlexContainerAnnc.class,
- FoamingFlexContainerAnnc.class, GrinderFlexContainerAnnc.class,
- NoiseFlexContainerAnnc.class, PersonSensorFlexContainerAnnc.class,
- StreamingFlexContainerAnnc.class, LockFlexContainerAnnc.class,
- BatteryFlexContainerAnnc.class,
- LiquidLevelFlexContainerAnnc.class, TimerFlexContainerAnnc.class,
- NumberValueFlexContainerAnnc.class, IncrementNumberValueFlexContainerAnnc.class,
- DecrementNumberValueFlexContainerAnnc.class, ResetNumberValueFlexContainerAnnc.class,
- ToggleFlexContainerAnnc.class})
public class AbstractFlexContainerAnnc extends AnnouncedResource {
@XmlTransient
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ActiveCmdhPolicy.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ActiveCmdhPolicy.java
index a366956..acc391b 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ActiveCmdhPolicy.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ActiveCmdhPolicy.java
@@ -57,7 +57,7 @@
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = { "activeCmdhPolicyLink" })
@XmlRootElement(name = "activeCmdhPolicy")
-public class ActiveCmdhPolicy extends MgmtResource {
+public class ActiveCmdhPolicy extends MgmtObj {
@XmlElement(required = true)
protected String activeCmdhPolicyLink;
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AnnounceableResource.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AnnounceableResource.java
index 996a1d1..3a4f74f 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AnnounceableResource.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AnnounceableResource.java
@@ -69,7 +69,7 @@
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "announceableResource")
@XmlSeeAlso({ LocationPolicy.class, RemoteCSE.class, Node.class, AE.class,
- NodeAnnc.class, MgmtResource.class, Group.class, Container.class, AbstractFlexContainer.class })
+ NodeAnnc.class, MgmtObj.class, Group.class, Container.class, AbstractFlexContainer.class })
@MappedSuperclass
public class AnnounceableResource extends RegularResource {
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AnnouncedMgmtResource.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AnnouncedMgmtResource.java
index f3d2ad5..f19d843 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AnnouncedMgmtResource.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AnnouncedMgmtResource.java
@@ -37,6 +37,8 @@
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.constants.ShortName;
+
/**
* <p>
* Java class for announcedMgmtResource complex type.
@@ -63,21 +65,32 @@
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "announcedMgmtResource", propOrder = { "mgmtDefinition",
- "objectIDs", "objectPaths", "description" })
+@XmlType(name = "announcedMgmtResource")
@XmlSeeAlso({ EventLogAnnc.class, RebootAnnc.class, DeviceCapabilityAnnc.class,
DeviceInfoAnnc.class, SoftwareAnnc.class, FirmwareAnnc.class,
AreaNwkDeviceInfoAnnc.class, AreaNwkInfoAnnc.class, BatteryAnnc.class,
MemoryAnnc.class })
public class AnnouncedMgmtResource extends AnnouncedResource {
- @XmlElement(required = true)
- protected BigInteger mgmtDefinition;
- @XmlList
+ @XmlElement(name = ShortName.MGMT_DEF, required = true, namespace="")
+ protected BigInteger mgmtDefinition;
+
+ @XmlList
+ @XmlElement(name = ShortName.OBJ_IDS, namespace="")
protected List<String> objectIDs;
- @XmlList
+
+ @XmlList
+ @XmlElement(name = ShortName.OBJ_PATHS, namespace="")
protected List<String> objectPaths;
+
+ @XmlElement(name = ShortName.DESCRIPTION, namespace="")
protected String description;
+
+ @XmlElement(name = ShortName.CHILD_RESOURCE, namespace="")
+ protected List<ChildResourceRef> childResource;
+
+ @XmlElement(namespace = "http://www.onem2m.org/xml/protocols", name = ShortName.SUB)
+ protected List<Subscription> subscriptions;
/**
* Gets the value of the mgmtDefinition property.
@@ -96,7 +109,7 @@
* allowed object is {@link BigInteger }
*
*/
- public void setMgmtDefinition(BigInteger value) {
+ protected void setMgmtDefinition(BigInteger value) {
this.mgmtDefinition = value;
}
@@ -179,4 +192,64 @@
this.description = value;
}
+ /**
+ * Gets the value of the childResource property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list, not a
+ * snapshot. Therefore any modification you make to the returned list will
+ * be present inside the JAXB object. This is why there is not a
+ * <CODE>set</CODE> method for the childResource property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ *
+ * <pre>
+ * getChildResource().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link ChildResourceRef }
+ *
+ *
+ */
+ public List<ChildResourceRef> getChildResource() {
+ if (childResource == null) {
+ childResource = new ArrayList<ChildResourceRef>();
+ }
+ return this.childResource;
+ }
+
+ /**
+ * Gets the value of the subscription property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list, not a
+ * snapshot. Therefore any modification you make to the returned list will
+ * be present inside the JAXB object. This is why there is not a
+ * <CODE>set</CODE> method for the subscription property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ *
+ * <pre>
+ * getSubscription().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link Subscription }
+ *
+ *
+ */
+ public List<Subscription> getSubscriptions() {
+ if (subscriptions == null) {
+ subscriptions = new ArrayList<Subscription>();
+ }
+ return this.subscriptions;
+ }
+
}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AreaNwkDeviceInfo.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AreaNwkDeviceInfo.java
index db4e056..d9ac967 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AreaNwkDeviceInfo.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AreaNwkDeviceInfo.java
@@ -38,6 +38,7 @@
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.constants.MgmtDefinitionTypes;
import org.eclipse.om2m.commons.constants.ShortName;
/**
@@ -74,31 +75,33 @@
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
-@XmlRootElement(name = ShortName.ANDI)
-public class AreaNwkDeviceInfo extends MgmtResource {
+@XmlRootElement(name = ShortName.AREA_NWK_DEVICE_INFO)
+public class AreaNwkDeviceInfo extends MgmtObjWithChildren {
- @XmlElement(required = true, name = ShortName.DEV_ID)
+ @XmlElement(required = true, name = ShortName.DEV_ID, namespace="")
protected String devID;
- @XmlElement(required = true, name = ShortName.DEV_TYPE)
+ @XmlElement(required = true, name = ShortName.DEV_TYPE, namespace="")
protected String devType;
- @XmlElement(required = true, name = ShortName.AREA_NWK_ID)
+ @XmlElement(required = true, name = ShortName.AREA_NWK_ID, namespace="")
@XmlSchemaType(name = "anyURI")
protected String areaNwkId;
@XmlSchemaType(name = "nonNegativeInteger")
- @XmlElement(name = ShortName.SLEEP_INTERVAL)
+ @XmlElement(name = ShortName.SLEEP_INTERVAL, namespace="")
protected BigInteger sleepInterval;
@XmlSchemaType(name = "nonNegativeInteger")
- @XmlElement(name = ShortName.SLEEP_DURATION)
+ @XmlElement(name = ShortName.SLEEP_DURATION, namespace="")
protected BigInteger sleepDuration;
- @XmlElement(name = ShortName.STATUS)
+ @XmlElement(name = ShortName.STATUS, namespace="")
protected String status;
@XmlList
- @XmlElement(required = true, name = ShortName.LIST_OF_NEIGHBORS)
+ @XmlElement(required = true, name = ShortName.LIST_OF_NEIGHBORS, namespace="")
protected List<String> listOfNeighbors;
- @XmlElement(name = ShortName.CHILD_RESOURCE)
- protected List<ChildResourceRef> childResource;
- @XmlElement(namespace = "http://www.onem2m.org/xml/protocols", name = ShortName.SUB)
- protected List<Subscription> subscription;
+
+
+ public AreaNwkDeviceInfo() {
+ super();
+ setMgmtDefinition(MgmtDefinitionTypes.AREA_NWK_DEVICE_INFO);
+ }
/**
* Gets the value of the devID property.
@@ -255,64 +258,4 @@
return this.listOfNeighbors;
}
- /**
- * Gets the value of the childResource property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the childResource property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getChildResource().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link ChildResourceRef }
- *
- *
- */
- public List<ChildResourceRef> getChildResource() {
- if (childResource == null) {
- childResource = new ArrayList<ChildResourceRef>();
- }
- return this.childResource;
- }
-
- /**
- * Gets the value of the subscription property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the subscription property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getSubscription().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link Subscription }
- *
- *
- */
- public List<Subscription> getSubscription() {
- if (subscription == null) {
- subscription = new ArrayList<Subscription>();
- }
- return this.subscription;
- }
-
}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AreaNwkDeviceInfoAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AreaNwkDeviceInfoAnnc.java
index 39a0c33..4cb6d72 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AreaNwkDeviceInfoAnnc.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AreaNwkDeviceInfoAnnc.java
@@ -38,6 +38,9 @@
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.constants.MgmtDefinitionTypes;
+import org.eclipse.om2m.commons.constants.ShortName;
+
/**
* <p>
* Java class for anonymous complex type.
@@ -71,26 +74,40 @@
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = { "devID", "devType", "areaNwkId",
- "sleepInterval", "sleepDuration", "status", "listOfNeighbors",
- "childResource", "subscription" })
-@XmlRootElement(name = "areaNwkDeviceInfoAnnc")
+@XmlType(name = "")
+@XmlRootElement(name = ShortName.AREA_NWK_DEVICE_INFO_ANNC)
public class AreaNwkDeviceInfoAnnc extends AnnouncedMgmtResource {
- protected String devID;
- protected String devType;
- @XmlSchemaType(name = "anyURI")
- protected String areaNwkId;
+ @XmlElement(required = false, name = ShortName.DEV_ID, namespace="")
+ protected String devID;
+
+ @XmlElement(required = false, name = ShortName.DEV_TYPE, namespace="")
+ protected String devType;
+
+ @XmlElement(required = false, name = ShortName.AREA_NWK_ID, namespace="")
+ @XmlSchemaType(name = "anyURI")
+ protected String areaNwkId;
+
@XmlSchemaType(name = "nonNegativeInteger")
- protected BigInteger sleepInterval;
+ @XmlElement(name = ShortName.SLEEP_INTERVAL, namespace="")
+ protected BigInteger sleepInterval;
+
@XmlSchemaType(name = "nonNegativeInteger")
- protected BigInteger sleepDuration;
- protected String status;
+ @XmlElement(name = ShortName.SLEEP_DURATION, namespace="")
+ protected BigInteger sleepDuration;
+
+ @XmlElement(name = ShortName.STATUS, namespace="")
+ protected String status;
+
@XmlList
- protected List<String> listOfNeighbors;
- protected List<ChildResourceRef> childResource;
- @XmlElement(namespace = "http://www.onem2m.org/xml/protocols")
- protected List<Subscription> subscription;
+ @XmlElement(required = false, name = ShortName.LIST_OF_NEIGHBORS, namespace="")
+ protected List<String> listOfNeighbors;
+
+
+ public AreaNwkDeviceInfoAnnc() {
+ super();
+ setMgmtDefinition(MgmtDefinitionTypes.AREA_NWK_DEVICE_INFO);
+ }
/**
* Gets the value of the devID property.
@@ -247,64 +264,4 @@
return this.listOfNeighbors;
}
- /**
- * Gets the value of the childResource property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the childResource property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getChildResource().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link ChildResourceRef }
- *
- *
- */
- public List<ChildResourceRef> getChildResource() {
- if (childResource == null) {
- childResource = new ArrayList<ChildResourceRef>();
- }
- return this.childResource;
- }
-
- /**
- * Gets the value of the subscription property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the subscription property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getSubscription().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link Subscription }
- *
- *
- */
- public List<Subscription> getSubscription() {
- if (subscription == null) {
- subscription = new ArrayList<Subscription>();
- }
- return this.subscription;
- }
-
}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AreaNwkInfo.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AreaNwkInfo.java
index 670a48d..f6aad27 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AreaNwkInfo.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AreaNwkInfo.java
@@ -36,6 +36,7 @@
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.constants.MgmtDefinitionTypes;
import org.eclipse.om2m.commons.constants.ShortName;
/**
@@ -67,18 +68,21 @@
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
-@XmlRootElement(name = ShortName.ANI)
-public class AreaNwkInfo extends MgmtResource {
+@XmlRootElement(name = ShortName.AREA_NWK_INFO)
+public class AreaNwkInfo extends MgmtObjWithChildren {
- @XmlElement(name = ShortName.AREA_NWK_TYPE, required = true)
+ @XmlElement(name = ShortName.AREA_NWK_TYPE, required = true, namespace="")
protected String areaNwkType;
+
@XmlList
- @XmlElement(name = ShortName.LIST_DEVICES, required = true)
+ @XmlElement(name = ShortName.LIST_DEVICES, required = true, namespace="")
protected List<String> listOfDevices;
- @XmlElement(name = ShortName.CHILD_RESOURCE)
- protected List<ChildResourceRef> childResource;
- @XmlElement(name = ShortName.SUB, namespace = "http://www.onem2m.org/xml/protocols")
- protected List<Subscription> subscription;
+
+
+ public AreaNwkInfo() {
+ super();
+ setMgmtDefinition(MgmtDefinitionTypes.AREA_NWK_INFO);
+ }
/**
* Gets the value of the areaNwkType property.
@@ -130,64 +134,4 @@
return this.listOfDevices;
}
- /**
- * Gets the value of the childResource property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the childResource property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getChildResource().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link ChildResourceRef }
- *
- *
- */
- public List<ChildResourceRef> getChildResource() {
- if (childResource == null) {
- childResource = new ArrayList<ChildResourceRef>();
- }
- return this.childResource;
- }
-
- /**
- * Gets the value of the subscription property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the subscription property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getSubscription().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link Subscription }
- *
- *
- */
- public List<Subscription> getSubscription() {
- if (subscription == null) {
- subscription = new ArrayList<Subscription>();
- }
- return this.subscription;
- }
-
}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AreaNwkInfoAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AreaNwkInfoAnnc.java
index 2b848ac..61d2717 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AreaNwkInfoAnnc.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AreaNwkInfoAnnc.java
@@ -36,6 +36,9 @@
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.constants.MgmtDefinitionTypes;
+import org.eclipse.om2m.commons.constants.ShortName;
+
/**
* <p>
* Java class for anonymous complex type.
@@ -64,17 +67,22 @@
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = { "areaNwkType", "listOfDevices",
- "childResource", "subscription" })
-@XmlRootElement(name = "areaNwkInfoAnnc")
+@XmlType(name = "")
+@XmlRootElement(name = ShortName.AREA_NWK_INFO_ANNC)
public class AreaNwkInfoAnnc extends AnnouncedMgmtResource {
- protected String areaNwkType;
- @XmlList
- protected List<String> listOfDevices;
- protected List<ChildResourceRef> childResource;
- @XmlElement(namespace = "http://www.onem2m.org/xml/protocols")
- protected List<Subscription> subscription;
+ @XmlElement(name = ShortName.AREA_NWK_TYPE, required = false, namespace="")
+ protected String areaNwkType;
+
+ @XmlList
+ @XmlElement(name = ShortName.LIST_DEVICES, required = false, namespace="")
+ protected List<String> listOfDevices;
+
+
+ public AreaNwkInfoAnnc() {
+ super();
+ setMgmtDefinition(MgmtDefinitionTypes.AREA_NWK_INFO);
+ }
/**
* Gets the value of the areaNwkType property.
@@ -126,64 +134,4 @@
return this.listOfDevices;
}
- /**
- * Gets the value of the childResource property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the childResource property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getChildResource().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link ChildResourceRef }
- *
- *
- */
- public List<ChildResourceRef> getChildResource() {
- if (childResource == null) {
- childResource = new ArrayList<ChildResourceRef>();
- }
- return this.childResource;
- }
-
- /**
- * Gets the value of the subscription property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the subscription property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getSubscription().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link Subscription }
- *
- *
- */
- public List<Subscription> getSubscription() {
- if (subscription == null) {
- subscription = new ArrayList<Subscription>();
- }
- return this.subscription;
- }
-
}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Battery.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Battery.java
index da46d2b..37bcfae 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Battery.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Battery.java
@@ -27,8 +27,6 @@
package org.eclipse.om2m.commons.resource;
import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@@ -37,6 +35,9 @@
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.constants.MgmtDefinitionTypes;
+import org.eclipse.om2m.commons.constants.ShortName;
+
/**
* <p>
* Java class for anonymous complex type.
@@ -61,22 +62,23 @@
* </complexContent>
* </complexType>
* </pre>
- *
- *
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = { "batteryLevel", "batteryStatus",
- "childResource", "subscription" })
-@XmlRootElement(name = "battery")
-public class Battery extends MgmtResource {
+@XmlType(name = "")
+@XmlRootElement(name = ShortName.BATTERY)
+public class Battery extends MgmtObjWithChildren {
@XmlSchemaType(name = "unsignedInt")
+ @XmlElement(name = ShortName.BATTERY_LEVEL, namespace="")
protected long batteryLevel;
- @XmlElement(required = true)
+ @XmlElement(name = ShortName.BATTERY_STATUS, required = true, namespace="")
protected BigInteger batteryStatus;
- protected List<ChildResourceRef> childResource;
- @XmlElement(namespace = "http://www.onem2m.org/xml/protocols")
- protected List<Subscription> subscription;
+
+
+ public Battery() {
+ super();
+ setMgmtDefinition(MgmtDefinitionTypes.BATTERY);
+ }
/**
* Gets the value of the batteryLevel property.
@@ -115,64 +117,4 @@
this.batteryStatus = value;
}
- /**
- * Gets the value of the childResource property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the childResource property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getChildResource().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link ChildResourceRef }
- *
- *
- */
- public List<ChildResourceRef> getChildResource() {
- if (childResource == null) {
- childResource = new ArrayList<ChildResourceRef>();
- }
- return this.childResource;
- }
-
- /**
- * Gets the value of the subscription property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the subscription property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getSubscription().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link Subscription }
- *
- *
- */
- public List<Subscription> getSubscription() {
- if (subscription == null) {
- subscription = new ArrayList<Subscription>();
- }
- return this.subscription;
- }
-
}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/BatteryAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/BatteryAnnc.java
index 6c59acc..409d87e 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/BatteryAnnc.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/BatteryAnnc.java
@@ -27,16 +27,15 @@
package org.eclipse.om2m.commons.resource;
import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.constants.ShortName;
+
/**
* <p>
* Java class for anonymous complex type.
@@ -65,17 +64,14 @@
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = { "batteryLevel", "batteryStatus",
- "childResource", "subscription" })
-@XmlRootElement(name = "batteryAnnc")
+@XmlType(name = "")
+@XmlRootElement(name = ShortName.BATTERY_ANNC)
public class BatteryAnnc extends AnnouncedMgmtResource {
@XmlSchemaType(name = "unsignedInt")
protected Long batteryLevel;
+
protected BigInteger batteryStatus;
- protected List<ChildResourceRef> childResource;
- @XmlElement(namespace = "http://www.onem2m.org/xml/protocols")
- protected List<Subscription> subscription;
/**
* Gets the value of the batteryLevel property.
@@ -119,64 +115,4 @@
this.batteryStatus = value;
}
- /**
- * Gets the value of the childResource property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the childResource property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getChildResource().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link ChildResourceRef }
- *
- *
- */
- public List<ChildResourceRef> getChildResource() {
- if (childResource == null) {
- childResource = new ArrayList<ChildResourceRef>();
- }
- return this.childResource;
- }
-
- /**
- * Gets the value of the subscription property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the subscription property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getSubscription().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link Subscription }
- *
- *
- */
- public List<Subscription> getSubscription() {
- if (subscription == null) {
- subscription = new ArrayList<Subscription>();
- }
- return this.subscription;
- }
-
}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CSEBase.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CSEBase.java
index 13443d1..a7869ff 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CSEBase.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CSEBase.java
@@ -38,7 +38,6 @@
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.XmlValue;
import org.eclipse.om2m.commons.constants.ShortName;
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhBuffer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhBuffer.java
index ea54217..fb6ce1d 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhBuffer.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhBuffer.java
@@ -38,6 +38,8 @@
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.constants.ShortName;
+
/**
* <p>
* Java class for anonymous complex type.
@@ -71,8 +73,8 @@
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = { "applicableEventCategory", "maxBufferSize",
"storagePriority" })
-@XmlRootElement(name = "cmdhBuffer")
-public class CmdhBuffer extends MgmtResource {
+@XmlRootElement(name = ShortName.CMDH_BUFFER)
+public class CmdhBuffer extends MgmtObj {
@XmlList
@XmlElement(required = true)
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhDefEcValue.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhDefEcValue.java
index 2ae1113..cbbcaca 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhDefEcValue.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhDefEcValue.java
@@ -38,6 +38,8 @@
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.constants.ShortName;
+
/**
* <p>
* Java class for anonymous complex type.
@@ -69,8 +71,8 @@
@XmlType(name = "", propOrder = { "order", "defEcValue", "requestOrigin",
"requestContext", "requestContextNotification",
"requestCharacteristics" })
-@XmlRootElement(name = "cmdhDefEcValue")
-public class CmdhDefEcValue extends MgmtResource {
+@XmlRootElement(name = ShortName.CMDH_DEF_EC_VALUE)
+public class CmdhDefEcValue extends MgmtObj {
@XmlElement(required = true)
@XmlSchemaType(name = "positiveInteger")
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhDefaults.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhDefaults.java
index c08d0cb..e27d1e5 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhDefaults.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhDefaults.java
@@ -35,6 +35,8 @@
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.constants.ShortName;
+
/**
* <p>
* Java class for anonymous complex type.
@@ -59,8 +61,8 @@
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = { "mgmtLink" })
-@XmlRootElement(name = "cmdhDefaults")
-public class CmdhDefaults extends MgmtResource {
+@XmlRootElement(name = ShortName.CMDH_DEFAULTS)
+public class CmdhDefaults extends MgmtObj {
@XmlElement(required = true)
protected List<MgmtLinkRef> mgmtLink;
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhEcDefParamValues.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhEcDefParamValues.java
index 64f977a..8247e1e 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhEcDefParamValues.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhEcDefParamValues.java
@@ -36,6 +36,8 @@
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.constants.ShortName;
+
/**
* <p>
* Java class for anonymous complex type.
@@ -67,8 +69,8 @@
@XmlType(name = "", propOrder = { "applicableEventCategory",
"defaultRequestExpTime", "defaultResultExpTime", "defaultOpExecTime",
"defaultRespPersistence", "defaultDelAggregation" })
-@XmlRootElement(name = "cmdhEcDefParamValues")
-public class CmdhEcDefParamValues extends MgmtResource {
+@XmlRootElement(name = ShortName.CMDH_EC_DEF_PARAM_VALUES)
+public class CmdhEcDefParamValues extends MgmtObj {
@XmlList
@XmlElement(required = true)
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhLimits.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhLimits.java
index 0882136..a766113 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhLimits.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhLimits.java
@@ -40,6 +40,8 @@
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import org.eclipse.om2m.commons.constants.ShortName;
+
/**
* <p>
* Java class for anonymous complex type.
@@ -85,8 +87,8 @@
"requestContextNotification", "requestCharacteristics",
"limitsEventCategory", "limitsRequestExpTime", "limitsResultExpTime",
"limitsOpExecTime", "limitsRespPersistence", "limitsDelAggregation" })
-@XmlRootElement(name = "cmdhLimits")
-public class CmdhLimits extends MgmtResource {
+@XmlRootElement(name = ShortName.CMDH_LIMITS)
+public class CmdhLimits extends MgmtObj {
@XmlElement(required = true)
@XmlSchemaType(name = "positiveInteger")
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhNetworkAccessRules.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhNetworkAccessRules.java
index c08be5d..b94f3a5 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhNetworkAccessRules.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhNetworkAccessRules.java
@@ -36,6 +36,8 @@
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.constants.ShortName;
+
/**
* <p>
* Java class for anonymous complex type.
@@ -61,8 +63,8 @@
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = { "applicableEventCategories", "mgmtLink" })
-@XmlRootElement(name = "cmdhNetworkAccessRules")
-public class CmdhNetworkAccessRules extends MgmtResource {
+@XmlRootElement(name = ShortName.CMDH_NETWORK_ACCESS_RULES)
+public class CmdhNetworkAccessRules extends MgmtObj {
@XmlList
@XmlElement(required = true)
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhNwAccessRule.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhNwAccessRule.java
index db4db06..fea3f52 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhNwAccessRule.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhNwAccessRule.java
@@ -38,6 +38,8 @@
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.constants.ShortName;
+
/**
* <p>
* Java class for anonymous complex type.
@@ -67,8 +69,8 @@
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = { "targetNetwork", "minReqVolume",
"backOffParameters", "otherConditions", "mgmtLink" })
-@XmlRootElement(name = "cmdhNwAccessRule")
-public class CmdhNwAccessRule extends MgmtResource {
+@XmlRootElement(name = ShortName.CMDH_NW_ACCESS_RULE)
+public class CmdhNwAccessRule extends MgmtObj {
@XmlList
@XmlElement(required = true)
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhPolicy.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhPolicy.java
index 9fda780..dc9c16a 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhPolicy.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CmdhPolicy.java
@@ -37,6 +37,8 @@
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.constants.ShortName;
+
/**
* <p>
* Java class for anonymous complex type.
@@ -62,8 +64,8 @@
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = { "rest" })
-@XmlRootElement(name = "cmdhPolicy")
-public class CmdhPolicy extends MgmtResource {
+@XmlRootElement(name = ShortName.CMDH_POLICY)
+public class CmdhPolicy extends MgmtObj {
@XmlElementRefs({
@XmlElementRef(name = "mgmtLink", type = JAXBElement.class, required = false),
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CustomAttribute.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CustomAttribute.java
index d42ea3f..1d6c1d4 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CustomAttribute.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CustomAttribute.java
@@ -9,17 +9,8 @@
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.XmlValue;
-import javax.xml.bind.annotation.adapters.XmlAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import org.eclipse.om2m.commons.constants.ShortName;
-import org.w3c.dom.Element;
-
@XmlAccessorType(XmlAccessType.NONE)
@XmlJavaTypeAdapter(CustomAttributeAdapter.class)
public class CustomAttribute {
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CustomAttributeAdapter.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CustomAttributeAdapter.java
index 5f183a2..9fa5b46 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CustomAttributeAdapter.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CustomAttributeAdapter.java
@@ -7,7 +7,6 @@
*******************************************************************************/
package org.eclipse.om2m.commons.resource;
-import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.adapters.XmlAdapter;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/DeviceCapability.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/DeviceCapability.java
index 2d4b34c..c3ac172 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/DeviceCapability.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/DeviceCapability.java
@@ -26,15 +26,15 @@
package org.eclipse.om2m.commons.resource;
-import java.util.ArrayList;
-import java.util.List;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.constants.MgmtDefinitionTypes;
+import org.eclipse.om2m.commons.constants.ShortName;
+
/**
* <p>
* Java class for anonymous complex type.
@@ -67,11 +67,9 @@
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = { "capabilityName", "attached",
- "capabilityActionStatus", "currentState", "enable", "disable",
- "childResource", "subscription" })
-@XmlRootElement(name = "deviceCapability")
-public class DeviceCapability extends MgmtResource {
+@XmlType(name = "")
+@XmlRootElement(name = ShortName.DEVICE_CAPABILITY)
+public class DeviceCapability extends MgmtObjWithChildren {
@XmlElement(required = true)
protected String capabilityName;
@@ -81,9 +79,12 @@
protected boolean currentState;
protected Boolean enable;
protected Boolean disable;
- protected List<ChildResourceRef> childResource;
- @XmlElement(namespace = "http://www.onem2m.org/xml/protocols")
- protected List<Subscription> subscription;
+
+
+ public DeviceCapability() {
+ super();
+ setMgmtDefinition(MgmtDefinitionTypes.DEVICE_CAPABILITY);
+ }
/**
* Gets the value of the capabilityName property.
@@ -201,64 +202,4 @@
this.disable = value;
}
- /**
- * Gets the value of the childResource property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the childResource property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getChildResource().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link ChildResourceRef }
- *
- *
- */
- public List<ChildResourceRef> getChildResource() {
- if (childResource == null) {
- childResource = new ArrayList<ChildResourceRef>();
- }
- return this.childResource;
- }
-
- /**
- * Gets the value of the subscription property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the subscription property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getSubscription().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link Subscription }
- *
- *
- */
- public List<Subscription> getSubscription() {
- if (subscription == null) {
- subscription = new ArrayList<Subscription>();
- }
- return this.subscription;
- }
-
}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/DeviceCapabilityAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/DeviceCapabilityAnnc.java
index fa1c275..03e66e7 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/DeviceCapabilityAnnc.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/DeviceCapabilityAnnc.java
@@ -26,15 +26,14 @@
package org.eclipse.om2m.commons.resource;
-import java.util.ArrayList;
-import java.util.List;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.constants.MgmtDefinitionTypes;
+import org.eclipse.om2m.commons.constants.ShortName;
+
/**
* <p>
* Java class for anonymous complex type.
@@ -67,10 +66,8 @@
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = { "capabilityName", "attached",
- "capabilityActionStatus", "currentState", "enable", "disable",
- "childResource", "subscription" })
-@XmlRootElement(name = "deviceCapabilityAnnc")
+@XmlType(name = "")
+@XmlRootElement(name = ShortName.DEVICE_CAPABILITY_ANNC)
public class DeviceCapabilityAnnc extends AnnouncedMgmtResource {
protected String capabilityName;
@@ -79,9 +76,12 @@
protected Boolean currentState;
protected Boolean enable;
protected Boolean disable;
- protected List<ChildResourceRef> childResource;
- @XmlElement(namespace = "http://www.onem2m.org/xml/protocols")
- protected List<Subscription> subscription;
+
+
+ public DeviceCapabilityAnnc() {
+ super();
+ setMgmtDefinition(MgmtDefinitionTypes.DEVICE_CAPABILITY);
+ }
/**
* Gets the value of the capabilityName property.
@@ -209,64 +209,4 @@
this.disable = value;
}
- /**
- * Gets the value of the childResource property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the childResource property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getChildResource().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link ChildResourceRef }
- *
- *
- */
- public List<ChildResourceRef> getChildResource() {
- if (childResource == null) {
- childResource = new ArrayList<ChildResourceRef>();
- }
- return this.childResource;
- }
-
- /**
- * Gets the value of the subscription property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the subscription property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getSubscription().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link Subscription }
- *
- *
- */
- public List<Subscription> getSubscription() {
- if (subscription == null) {
- subscription = new ArrayList<Subscription>();
- }
- return this.subscription;
- }
-
}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/DeviceInfo.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/DeviceInfo.java
index 2b93211..3dc3b18 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/DeviceInfo.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/DeviceInfo.java
@@ -26,15 +26,15 @@
package org.eclipse.om2m.commons.resource;
-import java.util.ArrayList;
-import java.util.List;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.constants.MgmtDefinitionTypes;
+import org.eclipse.om2m.commons.constants.ShortName;
+
/**
* <p>
* Java class for anonymous complex type.
@@ -55,6 +55,17 @@
* <element name="fwVersion" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="swVersion" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="hwVersion" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="manufacturerDetailsLink" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="manufacturingDate" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="subModel" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="deviceName" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="osVersion" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="country" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="location" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="systemTime" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="supportURL" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="presentationURL" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="protocol" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <choice minOccurs="0">
* <element name="childResource" type="{http://www.onem2m.org/xml/protocols}childResourceRef" maxOccurs="unbounded"/>
* <element ref="{http://www.onem2m.org/xml/protocols}subscription" maxOccurs="unbounded"/>
@@ -68,29 +79,53 @@
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = { "deviceLabel", "manufacturer", "model",
- "deviceType", "fwVersion", "swVersion", "hwVersion", "childResource",
- "subscription" })
-@XmlRootElement(name = "deviceInfo")
-public class DeviceInfo extends MgmtResource {
+@XmlType(name = "")
+@XmlRootElement(name = ShortName.DEVICE_INFO)
+public class DeviceInfo extends MgmtObjWithChildren {
- @XmlElement(required = true)
+ @XmlElement(required = true, name = ShortName.DEVICE_LABEL, namespace="")
protected String deviceLabel;
- @XmlElement(required = true)
+ @XmlElement(required = true, name = ShortName.MANUFACTURER, namespace="")
protected String manufacturer;
- @XmlElement(required = true)
+ @XmlElement(required = true, name = ShortName.DEVICE_MODEL, namespace="")
protected String model;
- @XmlElement(required = true)
+ @XmlElement(required = true, name = ShortName.DEVICE_TYPE, namespace="")
protected String deviceType;
- @XmlElement(required = true)
+
+ @XmlElement(name = ShortName.FW_VERSION, namespace="")
protected String fwVersion;
- @XmlElement(required = true)
+ @XmlElement(name = ShortName.SW_VERSION, namespace="")
protected String swVersion;
- @XmlElement(required = true)
+ @XmlElement(name = ShortName.HW_VERSION, namespace="")
protected String hwVersion;
- protected List<ChildResourceRef> childResource;
- @XmlElement(namespace = "http://www.onem2m.org/xml/protocols")
- protected List<Subscription> subscription;
+ @XmlElement(name = ShortName.MANUF_DET_LINKS, namespace="")
+ protected String manufacturerDetailsLink;
+ @XmlElement(name = ShortName.MANUF_DATE, namespace="")
+ protected String manufacturingDate;
+ @XmlElement(name = ShortName.DEVICE_SUB_MODEL, namespace="")
+ protected String subModel;
+ @XmlElement(name = ShortName.DEVICE_NAME, namespace="")
+ protected String deviceName;
+ @XmlElement(name = ShortName.OS_VERSION, namespace="")
+ protected String osVersion;
+ @XmlElement(name = ShortName.COUNTRY, namespace="")
+ protected String country;
+ @XmlElement(name = ShortName.LOCATION, namespace="")
+ protected String location;
+ @XmlElement(name = ShortName.SYS_TIME, namespace="")
+ protected String systemTime;
+ @XmlElement(name = ShortName.SUPPORT_URL, namespace="")
+ protected String supportURL;
+ @XmlElement(name = ShortName.PRES_URL, namespace="")
+ protected String presentationURL;
+ @XmlElement(name = ShortName.PROTOCOL, namespace="")
+ protected String protocol;
+
+
+ public DeviceInfo() {
+ super();
+ setMgmtDefinition(MgmtDefinitionTypes.DEVICE_INFO);
+ }
/**
* Gets the value of the deviceLabel property.
@@ -240,63 +275,156 @@
}
/**
- * Gets the value of the childResource property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the childResource property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getChildResource().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link ChildResourceRef }
- *
- *
+ * @return the manufacturerDetailsLink
*/
- public List<ChildResourceRef> getChildResource() {
- if (childResource == null) {
- childResource = new ArrayList<ChildResourceRef>();
- }
- return this.childResource;
+ public String getManufacturerDetailsLink() {
+ return manufacturerDetailsLink;
}
/**
- * Gets the value of the subscription property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the subscription property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getSubscription().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link Subscription }
- *
- *
+ * @param manufacturerDetailsLink the manufacturerDetailsLink to set
*/
- public List<Subscription> getSubscription() {
- if (subscription == null) {
- subscription = new ArrayList<Subscription>();
- }
- return this.subscription;
+ public void setManufacturerDetailsLink(String manufacturerDetailsLink) {
+ this.manufacturerDetailsLink = manufacturerDetailsLink;
}
+ /**
+ * @return the manufacturingDate
+ */
+ public String getManufacturingDate() {
+ return manufacturingDate;
+ }
+
+ /**
+ * @param manufacturingDate the manufacturingDate to set
+ */
+ public void setManufacturingDate(String manufacturingDate) {
+ this.manufacturingDate = manufacturingDate;
+ }
+
+ /**
+ * @return the subModel
+ */
+ public String getSubModel() {
+ return subModel;
+ }
+
+ /**
+ * @param subModel the subModel to set
+ */
+ public void setSubModel(String subModel) {
+ this.subModel = subModel;
+ }
+
+ /**
+ * @return the deviceName
+ */
+ public String getDeviceName() {
+ return deviceName;
+ }
+
+ /**
+ * @param deviceName the deviceName to set
+ */
+ public void setDeviceName(String deviceName) {
+ this.deviceName = deviceName;
+ }
+
+ /**
+ * @return the osVersion
+ */
+ public String getOsVersion() {
+ return osVersion;
+ }
+
+ /**
+ * @param osVersion the osVersion to set
+ */
+ public void setOsVersion(String osVersion) {
+ this.osVersion = osVersion;
+ }
+
+ /**
+ * @return the country
+ */
+ public String getCountry() {
+ return country;
+ }
+
+ /**
+ * @param country the country to set
+ */
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ /**
+ * @return the location
+ */
+ public String getLocation() {
+ return location;
+ }
+
+ /**
+ * @param location the location to set
+ */
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ /**
+ * @return the systemTime
+ */
+ public String getSystemTime() {
+ return systemTime;
+ }
+
+ /**
+ * @param systemTime the systemTime to set
+ */
+ public void setSystemTime(String systemTime) {
+ this.systemTime = systemTime;
+ }
+
+ /**
+ * @return the supportURL
+ */
+ public String getSupportURL() {
+ return supportURL;
+ }
+
+ /**
+ * @param supportURL the supportURL to set
+ */
+ public void setSupportURL(String supportURL) {
+ this.supportURL = supportURL;
+ }
+
+ /**
+ * @return the presentationURL
+ */
+ public String getPresentationURL() {
+ return presentationURL;
+ }
+
+ /**
+ * @param presentationURL the presentationURL to set
+ */
+ public void setPresentationURL(String presentationURL) {
+ this.presentationURL = presentationURL;
+ }
+
+ /**
+ * @return the protocol
+ */
+ public String getProtocol() {
+ return protocol;
+ }
+
+ /**
+ * @param protocol the protocol to set
+ */
+ public void setProtocol(String protocol) {
+ this.protocol = protocol;
+ }
}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/DeviceInfoAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/DeviceInfoAnnc.java
index ffe7368..734a8a3 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/DeviceInfoAnnc.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/DeviceInfoAnnc.java
@@ -26,15 +26,15 @@
package org.eclipse.om2m.commons.resource;
-import java.util.ArrayList;
-import java.util.List;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.constants.MgmtDefinitionTypes;
+import org.eclipse.om2m.commons.constants.ShortName;
+
/**
* <p>
* Java class for anonymous complex type.
@@ -68,23 +68,54 @@
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = { "deviceLabel", "manufacturer", "model",
- "deviceType", "fwVersion", "swVersion", "hwVersion", "childResource",
- "subscription" })
-@XmlRootElement(name = "deviceInfoAnnc")
+@XmlType(name = "")
+@XmlRootElement(name = ShortName.DEVICE_INFO_ANNC)
public class DeviceInfoAnnc extends AnnouncedMgmtResource {
+ @XmlElement(required = true, name = ShortName.DEVICE_LABEL, namespace="")
protected String deviceLabel;
+ @XmlElement(required = true, name = ShortName.MANUFACTURER, namespace="")
protected String manufacturer;
+ @XmlElement(required = true, name = ShortName.DEVICE_MODEL, namespace="")
protected String model;
+ @XmlElement(required = true, name = ShortName.DEVICE_TYPE, namespace="")
protected String deviceType;
- protected String fwVersion;
- protected String swVersion;
- protected String hwVersion;
- protected List<ChildResourceRef> childResource;
- @XmlElement(namespace = "http://www.onem2m.org/xml/protocols")
- protected List<Subscription> subscription;
+ @XmlElement(name = ShortName.FW_VERSION, namespace="")
+ protected String fwVersion;
+ @XmlElement(name = ShortName.SW_VERSION, namespace="")
+ protected String swVersion;
+ @XmlElement(name = ShortName.HW_VERSION, namespace="")
+ protected String hwVersion;
+ @XmlElement(name = ShortName.MANUF_DET_LINKS, namespace="")
+ protected String manufacturerDetailsLink;
+ @XmlElement(name = ShortName.MANUF_DATE, namespace="")
+ protected String manufacturingDate;
+ @XmlElement(name = ShortName.DEVICE_SUB_MODEL, namespace="")
+ protected String subModel;
+ @XmlElement(name = ShortName.DEVICE_NAME, namespace="")
+ protected String deviceName;
+ @XmlElement(name = ShortName.OS_VERSION, namespace="")
+ protected String osVersion;
+ @XmlElement(name = ShortName.COUNTRY, namespace="")
+ protected String country;
+ @XmlElement(name = ShortName.LOCATION, namespace="")
+ protected String location;
+ @XmlElement(name = ShortName.SYS_TIME, namespace="")
+ protected String systemTime;
+ @XmlElement(name = ShortName.SUPPORT_URL, namespace="")
+ protected String supportURL;
+ @XmlElement(name = ShortName.PRES_URL, namespace="")
+ protected String presentationURL;
+ @XmlElement(name = ShortName.PROTOCOL, namespace="")
+ protected String protocol;
+
+
+ public DeviceInfoAnnc() {
+ super();
+ setMgmtDefinition(MgmtDefinitionTypes.DEVICE_INFO);
+ }
+
/**
* Gets the value of the deviceLabel property.
*
@@ -233,63 +264,157 @@
}
/**
- * Gets the value of the childResource property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the childResource property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getChildResource().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link ChildResourceRef }
- *
- *
+ * @return the manufacturerDetailsLink
*/
- public List<ChildResourceRef> getChildResource() {
- if (childResource == null) {
- childResource = new ArrayList<ChildResourceRef>();
- }
- return this.childResource;
+ public String getManufacturerDetailsLink() {
+ return manufacturerDetailsLink;
}
/**
- * Gets the value of the subscription property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the subscription property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getSubscription().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link Subscription }
- *
- *
+ * @param manufacturerDetailsLink the manufacturerDetailsLink to set
*/
- public List<Subscription> getSubscription() {
- if (subscription == null) {
- subscription = new ArrayList<Subscription>();
- }
- return this.subscription;
+ public void setManufacturerDetailsLink(String manufacturerDetailsLink) {
+ this.manufacturerDetailsLink = manufacturerDetailsLink;
+ }
+
+ /**
+ * @return the manufacturingDate
+ */
+ public String getManufacturingDate() {
+ return manufacturingDate;
+ }
+
+ /**
+ * @param manufacturingDate the manufacturingDate to set
+ */
+ public void setManufacturingDate(String manufacturingDate) {
+ this.manufacturingDate = manufacturingDate;
+ }
+
+ /**
+ * @return the subModel
+ */
+ public String getSubModel() {
+ return subModel;
+ }
+
+ /**
+ * @param subModel the subModel to set
+ */
+ public void setSubModel(String subModel) {
+ this.subModel = subModel;
+ }
+
+ /**
+ * @return the deviceName
+ */
+ public String getDeviceName() {
+ return deviceName;
+ }
+
+ /**
+ * @param deviceName the deviceName to set
+ */
+ public void setDeviceName(String deviceName) {
+ this.deviceName = deviceName;
+ }
+
+ /**
+ * @return the osVersion
+ */
+ public String getOsVersion() {
+ return osVersion;
+ }
+
+ /**
+ * @param osVersion the osVersion to set
+ */
+ public void setOsVersion(String osVersion) {
+ this.osVersion = osVersion;
+ }
+
+ /**
+ * @return the country
+ */
+ public String getCountry() {
+ return country;
+ }
+
+ /**
+ * @param country the country to set
+ */
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ /**
+ * @return the location
+ */
+ public String getLocation() {
+ return location;
+ }
+
+ /**
+ * @param location the location to set
+ */
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ /**
+ * @return the systemTime
+ */
+ public String getSystemTime() {
+ return systemTime;
+ }
+
+ /**
+ * @param systemTime the systemTime to set
+ */
+ public void setSystemTime(String systemTime) {
+ this.systemTime = systemTime;
+ }
+
+ /**
+ * @return the supportURL
+ */
+ public String getSupportURL() {
+ return supportURL;
+ }
+
+ /**
+ * @param supportURL the supportURL to set
+ */
+ public void setSupportURL(String supportURL) {
+ this.supportURL = supportURL;
+ }
+
+ /**
+ * @return the presentationURL
+ */
+ public String getPresentationURL() {
+ return presentationURL;
+ }
+
+ /**
+ * @param presentationURL the presentationURL to set
+ */
+ public void setPresentationURL(String presentationURL) {
+ this.presentationURL = presentationURL;
+ }
+
+ /**
+ * @return the protocol
+ */
+ public String getProtocol() {
+ return protocol;
+ }
+
+ /**
+ * @param protocol the protocol to set
+ */
+ public void setProtocol(String protocol) {
+ this.protocol = protocol;
}
}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/DynAuthDasRequest.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/DynAuthDasRequest.java
index 6b53d9e..b4c119b 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/DynAuthDasRequest.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/DynAuthDasRequest.java
@@ -10,6 +10,7 @@
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/DynAuthDasResponse.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/DynAuthDasResponse.java
index ef3f598..f07aa81 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/DynAuthDasResponse.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/DynAuthDasResponse.java
@@ -9,6 +9,7 @@
import java.util.ArrayList;
import java.util.List;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlList;
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/EventLog.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/EventLog.java
index 214f218..f0d0ee5 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/EventLog.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/EventLog.java
@@ -36,6 +36,9 @@
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.constants.MgmtDefinitionTypes;
+import org.eclipse.om2m.commons.constants.ShortName;
+
/**
* <p>
* Java class for anonymous complex type.
@@ -67,10 +70,9 @@
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = { "logTypeId", "logData", "logStatus",
- "logStart", "logStop", "childResource", "subscription" })
-@XmlRootElement(name = "eventLog")
-public class EventLog extends MgmtResource {
+@XmlType(name = "")
+@XmlRootElement(name = ShortName.EVENT_LOG)
+public class EventLog extends MgmtObjWithChildren {
@XmlElement(required = true)
protected BigInteger logTypeId;
@@ -80,9 +82,14 @@
protected BigInteger logStatus;
protected boolean logStart;
protected boolean logStop;
- protected List<ChildResourceRef> childResource;
@XmlElement(namespace = "http://www.onem2m.org/xml/protocols")
protected List<Subscription> subscription;
+
+
+ public EventLog() {
+ super();
+ setMgmtDefinition(MgmtDefinitionTypes.EVENT_LOG);
+ }
/**
* Gets the value of the logTypeId property.
@@ -180,36 +187,6 @@
}
/**
- * Gets the value of the childResource property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the childResource property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getChildResource().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link ChildResourceRef }
- *
- *
- */
- public List<ChildResourceRef> getChildResource() {
- if (childResource == null) {
- childResource = new ArrayList<ChildResourceRef>();
- }
- return this.childResource;
- }
-
- /**
* Gets the value of the subscription property.
*
* <p>
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/EventLogAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/EventLogAnnc.java
index 5823dd8..813f85c 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/EventLogAnnc.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/EventLogAnnc.java
@@ -27,15 +27,15 @@
package org.eclipse.om2m.commons.resource;
import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.constants.MgmtDefinitionTypes;
+import org.eclipse.om2m.commons.constants.ShortName;
+
/**
* <p>
* Java class for anonymous complex type.
@@ -67,9 +67,8 @@
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = { "logTypeId", "logData", "logStatus",
- "logStart", "logStop", "childResource", "subscription" })
-@XmlRootElement(name = "eventLogAnnc")
+@XmlType(name = "")
+@XmlRootElement(name = ShortName.EVENT_LOG_ANNC)
public class EventLogAnnc extends AnnouncedMgmtResource {
protected BigInteger logTypeId;
@@ -77,9 +76,12 @@
protected BigInteger logStatus;
protected Boolean logStart;
protected Boolean logStop;
- protected List<ChildResourceRef> childResource;
- @XmlElement(namespace = "http://www.onem2m.org/xml/protocols")
- protected List<Subscription> subscription;
+
+
+ public EventLogAnnc() {
+ super();
+ setMgmtDefinition(MgmtDefinitionTypes.EVENT_LOG);
+ }
/**
* Gets the value of the logTypeId property.
@@ -186,64 +188,4 @@
this.logStop = value;
}
- /**
- * Gets the value of the childResource property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the childResource property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getChildResource().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link ChildResourceRef }
- *
- *
- */
- public List<ChildResourceRef> getChildResource() {
- if (childResource == null) {
- childResource = new ArrayList<ChildResourceRef>();
- }
- return this.childResource;
- }
-
- /**
- * Gets the value of the subscription property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the subscription property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getSubscription().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link Subscription }
- *
- *
- */
- public List<Subscription> getSubscription() {
- if (subscription == null) {
- subscription = new ArrayList<Subscription>();
- }
- return this.subscription;
- }
-
}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Firmware.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Firmware.java
index 112d20a..bc4e970 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Firmware.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Firmware.java
@@ -37,6 +37,9 @@
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.constants.MgmtDefinitionTypes;
+import org.eclipse.om2m.commons.constants.ShortName;
+
/**
* <p>
* Java class for anonymous complex type.
@@ -68,9 +71,9 @@
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = { "rest" })
-@XmlRootElement(name = "firmware")
-public class Firmware extends MgmtResource {
+@XmlType(name = "")
+@XmlRootElement(name = ShortName.FIRMWARE)
+public class Firmware extends MgmtObjWithChildren {
@XmlElementRefs({
@XmlElementRef(name = "version", type = JAXBElement.class, required = false),
@@ -81,6 +84,12 @@
@XmlElementRef(name = "name", type = JAXBElement.class, required = false),
@XmlElementRef(name = "update", type = JAXBElement.class, required = false) })
protected List<Object> rest;
+
+
+ public Firmware() {
+ super();
+ setMgmtDefinition(MgmtDefinitionTypes.FIRMWARE);
+ }
/**
* Gets the rest of the content model.
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/FirmwareAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/FirmwareAnnc.java
index 71e3831..5525047 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/FirmwareAnnc.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/FirmwareAnnc.java
@@ -37,6 +37,9 @@
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.constants.MgmtDefinitionTypes;
+import org.eclipse.om2m.commons.constants.ShortName;
+
/**
* <p>
* Java class for anonymous complex type.
@@ -68,8 +71,8 @@
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = { "rest" })
-@XmlRootElement(name = "firmwareAnnc")
+@XmlType(name = "")
+@XmlRootElement(name = ShortName.FIRMWARE_ANNC)
public class FirmwareAnnc extends AnnouncedMgmtResource {
@XmlElementRefs({
@@ -81,6 +84,12 @@
@XmlElementRef(name = "updateStatus", type = JAXBElement.class, required = false),
@XmlElementRef(name = "update", type = JAXBElement.class, required = false) })
protected List<Object> rest;
+
+
+ public FirmwareAnnc() {
+ super();
+ setMgmtDefinition(MgmtDefinitionTypes.FIRMWARE);
+ }
/**
* Gets the rest of the content model.
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Memory.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Memory.java
index 09cc75e..4c2fec5 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Memory.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Memory.java
@@ -27,8 +27,6 @@
package org.eclipse.om2m.commons.resource;
import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@@ -37,6 +35,9 @@
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.constants.MgmtDefinitionTypes;
+import org.eclipse.om2m.commons.constants.ShortName;
+
/**
* <p>
* Java class for anonymous complex type.
@@ -65,10 +66,9 @@
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = { "memAvailable", "memTotal", "childResource",
- "subscription" })
-@XmlRootElement(name = "memory")
-public class Memory extends MgmtResource {
+@XmlType(name = "")
+@XmlRootElement(name = ShortName.MEMORY)
+public class Memory extends MgmtObjWithChildren {
@XmlElement(required = true)
@XmlSchemaType(name = "unsignedLong")
@@ -76,9 +76,12 @@
@XmlElement(required = true)
@XmlSchemaType(name = "unsignedLong")
protected BigInteger memTotal;
- protected List<ChildResourceRef> childResource;
- @XmlElement(namespace = "http://www.onem2m.org/xml/protocols")
- protected List<Subscription> subscription;
+
+
+ public Memory() {
+ super();
+ setMgmtDefinition(MgmtDefinitionTypes.MEMORY);
+ }
/**
* Gets the value of the memAvailable property.
@@ -122,64 +125,4 @@
this.memTotal = value;
}
- /**
- * Gets the value of the childResource property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the childResource property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getChildResource().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link ChildResourceRef }
- *
- *
- */
- public List<ChildResourceRef> getChildResource() {
- if (childResource == null) {
- childResource = new ArrayList<ChildResourceRef>();
- }
- return this.childResource;
- }
-
- /**
- * Gets the value of the subscription property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the subscription property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getSubscription().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link Subscription }
- *
- *
- */
- public List<Subscription> getSubscription() {
- if (subscription == null) {
- subscription = new ArrayList<Subscription>();
- }
- return this.subscription;
- }
-
}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/MemoryAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/MemoryAnnc.java
index 6cbf857..0f4bae8 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/MemoryAnnc.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/MemoryAnnc.java
@@ -27,16 +27,16 @@
package org.eclipse.om2m.commons.resource;
import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.constants.MgmtDefinitionTypes;
+import org.eclipse.om2m.commons.constants.ShortName;
+
/**
* <p>
* Java class for anonymous complex type.
@@ -65,18 +65,20 @@
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = { "memAvailable", "memTotal", "childResource",
- "subscription" })
-@XmlRootElement(name = "memoryAnnc")
+@XmlType(name = "")
+@XmlRootElement(name = ShortName.MEMORY_ANNC)
public class MemoryAnnc extends AnnouncedMgmtResource {
@XmlSchemaType(name = "unsignedLong")
protected BigInteger memAvailable;
@XmlSchemaType(name = "unsignedLong")
protected BigInteger memTotal;
- protected List<ChildResourceRef> childResource;
- @XmlElement(namespace = "http://www.onem2m.org/xml/protocols")
- protected List<Subscription> subscription;
+
+
+ public MemoryAnnc() {
+ super();
+ setMgmtDefinition(MgmtDefinitionTypes.MEMORY);
+ }
/**
* Gets the value of the memAvailable property.
@@ -120,64 +122,4 @@
this.memTotal = value;
}
- /**
- * Gets the value of the childResource property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the childResource property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getChildResource().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link ChildResourceRef }
- *
- *
- */
- public List<ChildResourceRef> getChildResource() {
- if (childResource == null) {
- childResource = new ArrayList<ChildResourceRef>();
- }
- return this.childResource;
- }
-
- /**
- * Gets the value of the subscription property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the subscription property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getSubscription().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link Subscription }
- *
- *
- */
- public List<Subscription> getSubscription() {
- if (subscription == null) {
- subscription = new ArrayList<Subscription>();
- }
- return this.subscription;
- }
-
}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/MgmtResource.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/MgmtObj.java
similarity index 93%
rename from org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/MgmtResource.java
rename to org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/MgmtObj.java
index 1cc8bf5..948ce12 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/MgmtResource.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/MgmtObj.java
@@ -73,17 +73,20 @@
CmdhDefEcValue.class, CmdhNwAccessRule.class, Firmware.class,
AreaNwkInfo.class, Software.class, CmdhDefaults.class,
CmdhNetworkAccessRules.class })
-public class MgmtResource extends AnnounceableResource {
+public class MgmtObj extends AnnounceableResource {
- @XmlElement(name = ShortName.MGMT_DEF, required = true)
+ @XmlElement(name = ShortName.MGMT_DEF, required = true, namespace="")
protected BigInteger mgmtDefinition;
+
@XmlList
- @XmlElement(name = ShortName.OBJ_IDS)
+ @XmlElement(name = ShortName.OBJ_IDS, namespace="")
protected List<String> objectIDs;
+
@XmlList
- @XmlElement(name = ShortName.OBJ_PATHS)
+ @XmlElement(name = ShortName.OBJ_PATHS, namespace="")
protected List<String> objectPaths;
- @XmlElement(name = ShortName.DESCRIPTION)
+
+ @XmlElement(name = ShortName.DESCRIPTION, namespace="")
protected String description;
/**
@@ -103,7 +106,7 @@
* allowed object is {@link BigInteger }
*
*/
- public void setMgmtDefinition(BigInteger value) {
+ protected void setMgmtDefinition(BigInteger value) {
this.mgmtDefinition = value;
}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/MgmtObjWithChildren.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/MgmtObjWithChildren.java
new file mode 100644
index 0000000..eb6aea6
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/MgmtObjWithChildren.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2013-2016 LAAS-CNRS (www.laas.fr)
+ * 7 Colonel Roche 31077 Toulouse - France
+ *
+ * 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
+ *
+ * Initial Contributors:
+ * Thierry Monteil : Project manager, technical co-manager
+ * Mahdi Ben Alaya : Technical co-manager
+ * Samir Medjiah : Technical co-manager
+ * Khalil Drira : Strategy expert
+ * Guillaume Garzone : Developer
+ * François Aïssaoui : Developer
+ *
+ * New contributors :
+ *******************************************************************************/
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2015.04.15 at 03:56:27 PM CEST
+//
+
+package org.eclipse.om2m.commons.resource;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+
+import org.eclipse.om2m.commons.constants.ShortName;
+
+public class MgmtObjWithChildren extends MgmtObj {
+
+ @XmlElement(name = ShortName.CHILD_RESOURCE, namespace="")
+ protected List<ChildResourceRef> childResource;
+
+ @XmlElement(namespace = "http://www.onem2m.org/xml/protocols", name = ShortName.SUB)
+ protected List<Subscription> subscriptions;
+
+ /**
+ * Gets the value of the childResource property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list, not a
+ * snapshot. Therefore any modification you make to the returned list will
+ * be present inside the JAXB object. This is why there is not a
+ * <CODE>set</CODE> method for the childResource property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ *
+ * <pre>
+ * getChildResource().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link ChildResourceRef }
+ *
+ *
+ */
+ public List<ChildResourceRef> getChildResource() {
+ if (childResource == null) {
+ childResource = new ArrayList<ChildResourceRef>();
+ }
+ return this.childResource;
+ }
+
+ /**
+ * Gets the value of the subscription property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list, not a
+ * snapshot. Therefore any modification you make to the returned list will
+ * be present inside the JAXB object. This is why there is not a
+ * <CODE>set</CODE> method for the subscription property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ *
+ * <pre>
+ * getSubscription().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link Subscription }
+ *
+ *
+ */
+ public List<Subscription> getSubscriptions() {
+ if (subscriptions == null) {
+ subscriptions = new ArrayList<Subscription>();
+ }
+ return this.subscriptions;
+ }
+
+}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Node.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Node.java
index 2971ff5..0ced53f 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Node.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Node.java
@@ -89,15 +89,24 @@
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlElement(required = true, name = ShortName.NODE_ID, namespace="")
protected String nodeID;
- @XmlElement(name = ShortName.HOSTED_CSE_LINK)
+
+ @XmlElement(name = ShortName.HOSTED_CSE_LINK, namespace="")
protected String hostedCSELink;
- @XmlElement(name = ShortName.CHILD_RESOURCE)
+
+ @XmlElement(name = ShortName.HOSTED_APP_LINK, namespace="")
+ protected String hostedAppLinks;
+
+ @XmlElement(name = ShortName.CHILD_RESOURCE, namespace="")
protected List<ChildResourceRef> childResource;
+
+ @XmlElement(namespace = "http://www.onem2m.org/xml/protocols", name = ShortName.SUB)
+ protected List<Subscription> subscriptions;
+
@XmlElements({
@XmlElement(name = ShortName.MEMORY, namespace = "http://www.onem2m.org/xml/protocols", type = Memory.class),
@XmlElement(name = ShortName.BATTERY, namespace = "http://www.onem2m.org/xml/protocols", type = Battery.class),
- @XmlElement(name = ShortName.ANI, namespace = "http://www.onem2m.org/xml/protocols", type = AreaNwkInfo.class),
- @XmlElement(name = ShortName.ANDI, namespace = "http://www.onem2m.org/xml/protocols", type = AreaNwkDeviceInfo.class),
+ @XmlElement(name = ShortName.AREA_NWK_INFO, namespace = "http://www.onem2m.org/xml/protocols", type = AreaNwkInfo.class),
+ @XmlElement(name = ShortName.AREA_NWK_DEVICE_INFO, namespace = "http://www.onem2m.org/xml/protocols", type = AreaNwkDeviceInfo.class),
@XmlElement(name = ShortName.FIRMWARE, namespace = "http://www.onem2m.org/xml/protocols", type = Firmware.class),
@XmlElement(name = ShortName.SOFTWARE, namespace = "http://www.onem2m.org/xml/protocols", type = Software.class),
@XmlElement(name = ShortName.DEVICE_INFO, namespace = "http://www.onem2m.org/xml/protocols", type = DeviceInfo.class),
@@ -107,7 +116,7 @@
@XmlElement(name = ShortName.CMDH_POLICY, namespace = "http://www.onem2m.org/xml/protocols", type = CmdhPolicy.class),
@XmlElement(name = ShortName.ACTIVE_CMDH_POLICY, namespace = "http://www.onem2m.org/xml/protocols", type = ActiveCmdhPolicy.class),
@XmlElement(name = ShortName.SUB, namespace = "http://www.onem2m.org/xml/protocols", type = Subscription.class) })
- protected List<RegularResource> memoryOrBatteryOrAreaNwkInfo;
+ protected List<MgmtObj> mgmmtObjs;
/**
* Gets the value of the nodeID property.
@@ -152,6 +161,27 @@
}
/**
+ * Gets the value of the hostedAppLinks property.
+ *
+ * @return possible object is {@link String }
+ *
+ */
+ public String getHostedAppLinks() {
+ return hostedAppLinks;
+ }
+
+ /**
+ * Sets the value of the hostedAppLinks property.
+ *
+ * @param value
+ * allowed object is {@link String }
+ *
+ */
+ public void setHostedAppLinks(String value) {
+ this.hostedAppLinks = value;
+ }
+
+ /**
* Gets the value of the childResource property.
*
* <p>
@@ -182,6 +212,36 @@
}
/**
+ * Gets the value of the subscription property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list, not a
+ * snapshot. Therefore any modification you make to the returned list will
+ * be present inside the JAXB object. This is why there is not a
+ * <CODE>set</CODE> method for the subscription property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ *
+ * <pre>
+ * getSubscription().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link Subscription }
+ *
+ *
+ */
+ public List<Subscription> getSubscriptions() {
+ if (subscriptions == null) {
+ subscriptions = new ArrayList<Subscription>();
+ }
+ return this.subscriptions;
+ }
+
+ /**
* Gets the value of the memoryOrBatteryOrAreaNwkInfo property.
*
* <p>
@@ -207,11 +267,11 @@
*
*
*/
- public List<RegularResource> getMemoryOrBatteryOrAreaNwkInfo() {
- if (memoryOrBatteryOrAreaNwkInfo == null) {
- memoryOrBatteryOrAreaNwkInfo = new ArrayList<RegularResource>();
+ public List<MgmtObj> getMgmtObjs() {
+ if (mgmmtObjs == null) {
+ mgmmtObjs = new ArrayList<MgmtObj>();
}
- return this.memoryOrBatteryOrAreaNwkInfo;
+ return this.mgmmtObjs;
}
}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ObjectFactory.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ObjectFactory.java
index 08a0ac8..7c3c364 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ObjectFactory.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ObjectFactory.java
@@ -366,11 +366,11 @@
}
/**
- * Create an instance of {@link MgmtResource }
+ * Create an instance of {@link MgmtObj }
*
*/
- public MgmtResource createMgmtResource() {
- return new MgmtResource();
+ public MgmtObj createMgmtResource() {
+ return new MgmtObj();
}
/**
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Reboot.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Reboot.java
index 87e3c0d..aaa6eaa 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Reboot.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Reboot.java
@@ -26,15 +26,14 @@
package org.eclipse.om2m.commons.resource;
-import java.util.ArrayList;
-import java.util.List;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.constants.MgmtDefinitionTypes;
+import org.eclipse.om2m.commons.constants.ShortName;
+
/**
* <p>
* Java class for anonymous complex type.
@@ -63,16 +62,18 @@
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = { "reboot", "factoryReset", "childResource",
- "subscription" })
-@XmlRootElement(name = "reboot")
-public class Reboot extends MgmtResource {
+@XmlType(name = "")
+@XmlRootElement(name = ShortName.REBOOT)
+public class Reboot extends MgmtObjWithChildren {
protected boolean reboot;
protected boolean factoryReset;
- protected List<ChildResourceRef> childResource;
- @XmlElement(namespace = "http://www.onem2m.org/xml/protocols")
- protected List<Subscription> subscription;
+
+
+ public Reboot() {
+ super();
+ setMgmtDefinition(MgmtDefinitionTypes.REBOOT);
+ }
/**
* Gets the value of the reboot property.
@@ -106,64 +107,4 @@
this.factoryReset = value;
}
- /**
- * Gets the value of the childResource property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the childResource property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getChildResource().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link ChildResourceRef }
- *
- *
- */
- public List<ChildResourceRef> getChildResource() {
- if (childResource == null) {
- childResource = new ArrayList<ChildResourceRef>();
- }
- return this.childResource;
- }
-
- /**
- * Gets the value of the subscription property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the subscription property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getSubscription().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link Subscription }
- *
- *
- */
- public List<Subscription> getSubscription() {
- if (subscription == null) {
- subscription = new ArrayList<Subscription>();
- }
- return this.subscription;
- }
-
}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/RebootAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/RebootAnnc.java
index 365e61f..50f53dd 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/RebootAnnc.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/RebootAnnc.java
@@ -26,15 +26,13 @@
package org.eclipse.om2m.commons.resource;
-import java.util.ArrayList;
-import java.util.List;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.constants.ShortName;
+
/**
* <p>
* Java class for anonymous complex type.
@@ -63,16 +61,12 @@
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = { "reboot", "factoryReset", "childResource",
- "subscription" })
-@XmlRootElement(name = "rebootAnnc")
+@XmlType(name = "")
+@XmlRootElement(name = ShortName.REBOOT_ANNC)
public class RebootAnnc extends AnnouncedMgmtResource {
protected Boolean reboot;
protected Boolean factoryReset;
- protected List<ChildResourceRef> childResource;
- @XmlElement(namespace = "http://www.onem2m.org/xml/protocols")
- protected List<Subscription> subscription;
/**
* Gets the value of the reboot property.
@@ -116,64 +110,4 @@
this.factoryReset = value;
}
- /**
- * Gets the value of the childResource property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the childResource property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getChildResource().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link ChildResourceRef }
- *
- *
- */
- public List<ChildResourceRef> getChildResource() {
- if (childResource == null) {
- childResource = new ArrayList<ChildResourceRef>();
- }
- return this.childResource;
- }
-
- /**
- * Gets the value of the subscription property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a
- * snapshot. Therefore any modification you make to the returned list will
- * be present inside the JAXB object. This is why there is not a
- * <CODE>set</CODE> method for the subscription property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getSubscription().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link Subscription }
- *
- *
- */
- public List<Subscription> getSubscription() {
- if (subscription == null) {
- subscription = new ArrayList<Subscription>();
- }
- return this.subscription;
- }
-
}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ReceiverESPrimRandObject.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ReceiverESPrimRandObject.java
index 1361f6c..a1deeb6 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ReceiverESPrimRandObject.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ReceiverESPrimRandObject.java
@@ -11,6 +11,7 @@
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/RegularResource.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/RegularResource.java
index 703468e..071c80d 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/RegularResource.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/RegularResource.java
@@ -36,7 +36,6 @@
import javax.xml.bind.annotation.XmlList;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.XmlValue;
import org.eclipse.om2m.commons.constants.ShortName;
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/SecurityInfo.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/SecurityInfo.java
index c2d228a..24d941a 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/SecurityInfo.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/SecurityInfo.java
@@ -8,6 +8,7 @@
package org.eclipse.om2m.commons.resource;
import java.math.BigInteger;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Software.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Software.java
index e8112ea..e5a3ca0 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Software.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Software.java
@@ -37,6 +37,9 @@
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.constants.MgmtDefinitionTypes;
+import org.eclipse.om2m.commons.constants.ShortName;
+
/**
* <p>
* Java class for anonymous complex type.
@@ -72,9 +75,9 @@
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = { "rest" })
-@XmlRootElement(name = "software")
-public class Software extends MgmtResource {
+@XmlType(name = "")
+@XmlRootElement(name = ShortName.SOFTWARE)
+public class Software extends MgmtObjWithChildren {
@XmlElementRefs({
@XmlElementRef(name = "activeStatus", type = JAXBElement.class, required = false),
@@ -89,6 +92,12 @@
@XmlElementRef(name = "name", type = JAXBElement.class, required = false),
@XmlElementRef(name = "version", type = JAXBElement.class, required = false) })
protected List<Object> rest;
+
+
+ public Software() {
+ super();
+ setMgmtDefinition(MgmtDefinitionTypes.SOFTWARE);
+ }
/**
* Gets the rest of the content model.
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/SoftwareAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/SoftwareAnnc.java
index a616939..f89df00 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/SoftwareAnnc.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/SoftwareAnnc.java
@@ -37,6 +37,8 @@
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.constants.ShortName;
+
/**
* <p>
* Java class for anonymous complex type.
@@ -72,8 +74,8 @@
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = { "rest" })
-@XmlRootElement(name = "softwareAnnc")
+@XmlType(name = "")
+@XmlRootElement(name = ShortName.SOFTWARE_ANNC)
public class SoftwareAnnc extends AnnouncedMgmtResource {
@XmlElementRefs({
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/URIList.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/URIList.java
index 71fb67c..9dffb6c 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/URIList.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/URIList.java
@@ -5,14 +5,8 @@
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAnyElement;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlList;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.XmlValue;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.eclipse.om2m.commons.constants.ShortName;
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/Activator.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/Activator.java
index 2dfb825..8586800 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/Activator.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/Activator.java
@@ -26,7 +26,6 @@
import org.eclipse.om2m.commons.constants.Constants;
import org.eclipse.om2m.core.comm.RestClient;
import org.eclipse.om2m.core.datamapper.DataMapperSelector;
-import org.eclipse.om2m.core.dynamicauthorization.DynamicAuthorizationSelector;
import org.eclipse.om2m.core.flexcontainer.FlexContainerSelector;
import org.eclipse.om2m.core.interworking.IpeSelector;
import org.eclipse.om2m.core.persistence.PersistenceService;
@@ -43,7 +42,6 @@
import org.osgi.framework.ServiceReference;
import org.osgi.service.event.EventAdmin;
import org.osgi.util.tracker.ServiceTracker;
-import org.osgi.util.tracker.ServiceTrackerCustomizer;
/**
* Manages the starting and stopping of the bundle.
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/CSEInitializer.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/CSEInitializer.java
index 8520b2f..d935839 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/CSEInitializer.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/CSEInitializer.java
@@ -22,7 +22,6 @@
import java.math.BigInteger;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import org.apache.commons.logging.Log;
@@ -45,7 +44,6 @@
import org.eclipse.om2m.commons.resource.RemoteCSE;
import org.eclipse.om2m.commons.resource.RequestPrimitive;
import org.eclipse.om2m.commons.resource.ResponsePrimitive;
-import org.eclipse.om2m.commons.resource.ResponseTypeInfo;
import org.eclipse.om2m.commons.utils.Util.DateUtil;
import org.eclipse.om2m.core.comm.RestClient;
import org.eclipse.om2m.core.controller.Controller;
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/announcer/Announcer.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/announcer/Announcer.java
index b957ae5..b42e2f4 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/announcer/Announcer.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/announcer/Announcer.java
@@ -34,10 +34,10 @@
import org.eclipse.om2m.commons.exceptions.NotImplementedException;
import org.eclipse.om2m.commons.resource.AE;
import org.eclipse.om2m.commons.resource.AEAnnc;
-import org.eclipse.om2m.commons.resource.AnnounceableResource;
-import org.eclipse.om2m.commons.resource.AnnouncedResource;
import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.AnnounceableResource;
+import org.eclipse.om2m.commons.resource.AnnouncedResource;
import org.eclipse.om2m.commons.resource.RequestPrimitive;
import org.eclipse.om2m.commons.resource.ResponsePrimitive;
import org.eclipse.om2m.commons.resource.flexcontainerspec.FlexContainerFactory;
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/AEAnncController.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/AEAnncController.java
index b637799..65af095 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/AEAnncController.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/AEAnncController.java
@@ -18,21 +18,14 @@
import org.eclipse.om2m.commons.constants.ResponseStatusCode;
import org.eclipse.om2m.commons.constants.ResultContent;
import org.eclipse.om2m.commons.constants.ShortName;
-import org.eclipse.om2m.commons.entities.AccessControlOriginatorEntity;
import org.eclipse.om2m.commons.entities.AccessControlPolicyEntity;
-import org.eclipse.om2m.commons.entities.AccessControlRuleEntity;
import org.eclipse.om2m.commons.entities.AeAnncEntity;
-import org.eclipse.om2m.commons.entities.AeEntity;
-import org.eclipse.om2m.commons.entities.AnnounceableSubordinateEntity;
-import org.eclipse.om2m.commons.entities.CSEBaseEntity;
import org.eclipse.om2m.commons.entities.DynamicAuthorizationConsultationEntity;
-import org.eclipse.om2m.commons.entities.FlexContainerEntity;
import org.eclipse.om2m.commons.entities.RemoteCSEEntity;
import org.eclipse.om2m.commons.entities.ResourceEntity;
import org.eclipse.om2m.commons.entities.SubscriptionEntity;
import org.eclipse.om2m.commons.exceptions.BadRequestException;
import org.eclipse.om2m.commons.exceptions.ConflictException;
-import org.eclipse.om2m.commons.exceptions.NotImplementedException;
import org.eclipse.om2m.commons.exceptions.NotPermittedAttrException;
import org.eclipse.om2m.commons.exceptions.ResourceNotFoundException;
import org.eclipse.om2m.commons.resource.AE;
@@ -40,7 +33,6 @@
import org.eclipse.om2m.commons.resource.RequestPrimitive;
import org.eclipse.om2m.commons.resource.ResponsePrimitive;
import org.eclipse.om2m.commons.utils.Util.DateUtil;
-import org.eclipse.om2m.core.announcer.Announcer;
import org.eclipse.om2m.core.datamapper.DataMapperSelector;
import org.eclipse.om2m.core.entitymapper.EntityMapperFactory;
import org.eclipse.om2m.core.notifier.Notifier;
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/AEController.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/AEController.java
index 812bdc2..b23308c 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/AEController.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/AEController.java
@@ -29,9 +29,7 @@
import org.eclipse.om2m.commons.constants.ResourceType;
import org.eclipse.om2m.commons.constants.ResponseStatusCode;
import org.eclipse.om2m.commons.constants.ShortName;
-import org.eclipse.om2m.commons.entities.AccessControlOriginatorEntity;
import org.eclipse.om2m.commons.entities.AccessControlPolicyEntity;
-import org.eclipse.om2m.commons.entities.AccessControlRuleEntity;
import org.eclipse.om2m.commons.entities.AeEntity;
import org.eclipse.om2m.commons.entities.CSEBaseEntity;
import org.eclipse.om2m.commons.entities.DynamicAuthorizationConsultationEntity;
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/AccessControlPolicyController.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/AccessControlPolicyController.java
index e5beba7..ff49e6e 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/AccessControlPolicyController.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/AccessControlPolicyController.java
@@ -32,7 +32,6 @@
import org.eclipse.om2m.commons.entities.AccessControlRuleEntity;
import org.eclipse.om2m.commons.entities.AeEntity;
import org.eclipse.om2m.commons.entities.CSEBaseEntity;
-import org.eclipse.om2m.commons.entities.RegularResourceEntity;
import org.eclipse.om2m.commons.entities.RemoteCSEEntity;
import org.eclipse.om2m.commons.entities.ResourceEntity;
import org.eclipse.om2m.commons.entities.SubscriptionEntity;
@@ -47,14 +46,11 @@
import org.eclipse.om2m.core.datamapper.DataMapperSelector;
import org.eclipse.om2m.core.entitymapper.EntityMapperFactory;
import org.eclipse.om2m.core.notifier.Notifier;
-import org.eclipse.om2m.core.persistence.PersistenceService;
import org.eclipse.om2m.core.router.Patterns;
import org.eclipse.om2m.core.urimapper.UriMapper;
import org.eclipse.om2m.core.util.ControllerUtil;
import org.eclipse.om2m.core.util.ControllerUtil.UpdateUtil;
import org.eclipse.om2m.persistence.service.DAO;
-import org.eclipse.om2m.persistence.service.DBService;
-import org.eclipse.om2m.persistence.service.DBTransaction;
/**
* Controller for Access Control policy
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/Controller.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/Controller.java
index c98ece0..aef6312 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/Controller.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/Controller.java
@@ -32,14 +32,11 @@
import org.eclipse.om2m.commons.entities.AccessControlOriginatorEntity;
import org.eclipse.om2m.commons.entities.AccessControlPolicyEntity;
import org.eclipse.om2m.commons.entities.AccessControlRuleEntity;
-import org.eclipse.om2m.commons.entities.DynamicAuthorizationConsultationEntity;
import org.eclipse.om2m.commons.entities.ResourceEntity;
import org.eclipse.om2m.commons.exceptions.AccessDeniedException;
import org.eclipse.om2m.commons.exceptions.BadRequestException;
import org.eclipse.om2m.commons.exceptions.Om2mException;
import org.eclipse.om2m.commons.exceptions.ResourceNotFoundException;
-import org.eclipse.om2m.commons.resource.AccessControlPolicy;
-import org.eclipse.om2m.commons.resource.AccessControlRule;
import org.eclipse.om2m.commons.resource.RequestPrimitive;
import org.eclipse.om2m.commons.resource.Resource;
import org.eclipse.om2m.commons.resource.ResponsePrimitive;
@@ -339,15 +336,15 @@
}
protected void setLocationAndCreationContent(RequestPrimitive request,
- ResponsePrimitive response, ResourceEntity entity){
- setLocationAndCreationContent(request, response, entity, EntityMapperFactory.
- getMapperFromResourceType(entity.getResourceType().intValue()));
+ ResponsePrimitive response, ResourceEntity entity) {
+ EntityMapper mapper = EntityMapperFactory.getMapperFromResourceType(entity.getResourceType().intValue());
+ setLocationAndCreationContent(request, response, entity, mapper);
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({ "unchecked", "rawtypes" })
protected void setLocationAndCreationContent(RequestPrimitive request,
- ResponsePrimitive response, ResourceEntity entity, @SuppressWarnings("rawtypes") EntityMapper mapper){
- if(request.getResultContent()!= null){
+ ResponsePrimitive response, ResourceEntity entity, EntityMapper mapper) {
+ if (request.getResultContent() != null) {
if (request.getResultContent().equals(ResultContent.HIERARCHICAL_ADRESS)
|| request.getResultContent().equals(ResultContent.HIERARCHICAL_AND_ATTRIBUTES)){
response.setLocation(entity.getHierarchicalURI());
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/DiscoveryController.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/DiscoveryController.java
index ee9e9f2..621f37c 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/DiscoveryController.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/DiscoveryController.java
@@ -28,14 +28,11 @@
import org.eclipse.om2m.commons.constants.DiscoveryResultType;
import org.eclipse.om2m.commons.constants.FilterUsage;
-import org.eclipse.om2m.commons.constants.Operation;
import org.eclipse.om2m.commons.constants.ResourceType;
import org.eclipse.om2m.commons.constants.ResponseStatusCode;
import org.eclipse.om2m.commons.entities.AccessControlPolicyEntity;
import org.eclipse.om2m.commons.entities.AeAnncEntity;
import org.eclipse.om2m.commons.entities.AeEntity;
-import org.eclipse.om2m.commons.entities.AreaNwkDeviceInfoEntity;
-import org.eclipse.om2m.commons.entities.AreaNwkInfoEntity;
import org.eclipse.om2m.commons.entities.CSEBaseEntity;
import org.eclipse.om2m.commons.entities.ContainerEntity;
import org.eclipse.om2m.commons.entities.ContentInstanceEntity;
@@ -44,6 +41,7 @@
import org.eclipse.om2m.commons.entities.FlexContainerEntity;
import org.eclipse.om2m.commons.entities.GroupEntity;
import org.eclipse.om2m.commons.entities.LabelEntity;
+import org.eclipse.om2m.commons.entities.MgmtObjEntity;
import org.eclipse.om2m.commons.entities.NodeEntity;
import org.eclipse.om2m.commons.entities.RemoteCSEEntity;
import org.eclipse.om2m.commons.entities.ResourceEntity;
@@ -58,11 +56,8 @@
import org.eclipse.om2m.commons.resource.RequestPrimitive;
import org.eclipse.om2m.commons.resource.ResponsePrimitive;
import org.eclipse.om2m.commons.resource.URIList;
-import org.eclipse.om2m.core.persistence.PersistenceService;
import org.eclipse.om2m.core.router.Patterns;
import org.eclipse.om2m.persistence.service.DAO;
-import org.eclipse.om2m.persistence.service.DBService;
-import org.eclipse.om2m.persistence.service.DBTransaction;
/**
* Controller for Discovery operation
@@ -102,7 +97,7 @@
// Get the filter criteria object from request primitive
FilterCriteria filter = request.getFilterCriteria();
- if(filter.getFilterUsage().equals(FilterUsage.EVENT_NOTIFICATION_CRITERIA)){
+ if (filter.getFilterUsage().equals(FilterUsage.EVENT_NOTIFICATION_CRITERIA)){
throw new NotImplementedException("Event notification criteria is not implemented");
}
@@ -111,7 +106,7 @@
}
// Check the discovery result type
- if(request.getDiscoveryResultType() == null){
+ if (request.getDiscoveryResultType() == null){
request.setDiscoveryResultType(DiscoveryResultType.HIERARCHICAL);
}
if (request.getDiscoveryResultType().equals(DiscoveryResultType.CSEID_AND_RESOURCEID)){
@@ -178,8 +173,6 @@
} catch (AccessDeniedException e) {
// nothing to do
}
-
-
}
}
@@ -229,13 +222,7 @@
case ResourceType.NODE:
return ((NodeEntity) resourceEntity).getAccessControlPolicies();
case ResourceType.MGMT_OBJ:
- if (resourceEntity instanceof AreaNwkInfoEntity) {
- return ((AreaNwkInfoEntity) resourceEntity).getAccessControlPolicies();
- }
- if (resourceEntity instanceof AreaNwkDeviceInfoEntity) {
- return ((AreaNwkDeviceInfoEntity) resourceEntity).getAccessControlPolicies();
- }
- return null;
+ return ((MgmtObjEntity)resourceEntity).getAccessControlPolicies();
default:
// TODO On implementing resource, add the reference here
return null;
@@ -283,6 +270,7 @@
case(ResourceType.MGMT_OBJ):
result.addAll(labelEntity.getLinkedAni());
result.addAll(labelEntity.getLinkedAndi());
+ result.addAll(labelEntity.getLinkedDvi());
break;
case(ResourceType.SUBSCRIPTION):
result.addAll(labelEntity.getLinkedSub());
@@ -304,6 +292,7 @@
result.addAll(labelEntity.getLinkedNodes());
result.addAll(labelEntity.getLinkedAni());
result.addAll(labelEntity.getLinkedAndi());
+ result.addAll(labelEntity.getLinkedDvi());
result.addAll(labelEntity.getLinkedSub());
}
return result;
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/DynamicAuthorizationConsultationController.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/DynamicAuthorizationConsultationController.java
index 0414e5a..32e4c4b 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/DynamicAuthorizationConsultationController.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/DynamicAuthorizationConsultationController.java
@@ -7,7 +7,6 @@
*******************************************************************************/
package org.eclipse.om2m.core.controller;
-import java.util.ArrayList;
import java.util.List;
import org.eclipse.om2m.commons.constants.Constants;
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/FlexContainerAnncController.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/FlexContainerAnncController.java
index a375edd..aee70c3 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/FlexContainerAnncController.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/FlexContainerAnncController.java
@@ -19,38 +19,25 @@
import org.eclipse.om2m.commons.constants.ShortName;
import org.eclipse.om2m.commons.entities.AccessControlPolicyEntity;
import org.eclipse.om2m.commons.entities.AeAnncEntity;
-import org.eclipse.om2m.commons.entities.AeEntity;
-import org.eclipse.om2m.commons.entities.CSEBaseEntity;
-import org.eclipse.om2m.commons.entities.ContainerEntity;
import org.eclipse.om2m.commons.entities.DynamicAuthorizationConsultationEntity;
import org.eclipse.om2m.commons.entities.FlexContainerAnncEntity;
-import org.eclipse.om2m.commons.entities.FlexContainerEntity;
-import org.eclipse.om2m.commons.entities.RemoteCSEEntity;
import org.eclipse.om2m.commons.entities.ResourceEntity;
import org.eclipse.om2m.commons.entities.SubscriptionEntity;
import org.eclipse.om2m.commons.exceptions.BadRequestException;
import org.eclipse.om2m.commons.exceptions.ConflictException;
-import org.eclipse.om2m.commons.exceptions.NotImplementedException;
import org.eclipse.om2m.commons.exceptions.NotPermittedAttrException;
-import org.eclipse.om2m.commons.exceptions.Om2mException;
import org.eclipse.om2m.commons.exceptions.ResourceNotFoundException;
-import org.eclipse.om2m.commons.resource.CustomAttribute;
-import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
import org.eclipse.om2m.commons.resource.RequestPrimitive;
import org.eclipse.om2m.commons.resource.ResponsePrimitive;
import org.eclipse.om2m.commons.utils.Util.DateUtil;
-import org.eclipse.om2m.core.announcer.Announcer;
import org.eclipse.om2m.core.datamapper.DataMapperSelector;
import org.eclipse.om2m.core.entitymapper.EntityMapperFactory;
-import org.eclipse.om2m.core.flexcontainer.FlexContainerSelector;
-import org.eclipse.om2m.core.flexcontainer.FlexContainerXMLValidator;
import org.eclipse.om2m.core.notifier.Notifier;
import org.eclipse.om2m.core.redirector.Redirector;
import org.eclipse.om2m.core.router.Patterns;
import org.eclipse.om2m.core.urimapper.UriMapper;
import org.eclipse.om2m.core.util.ControllerUtil;
-import org.eclipse.om2m.flexcontainer.service.FlexContainerService;
import org.eclipse.om2m.persistence.service.DAO;
public class FlexContainerAnncController extends Controller {
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/FlexContainerController.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/FlexContainerController.java
index da530a5..617bd19 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/FlexContainerController.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/FlexContainerController.java
@@ -9,8 +9,6 @@
import java.util.List;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.eclipse.om2m.commons.constants.Constants;
import org.eclipse.om2m.commons.constants.MimeMediaType;
import org.eclipse.om2m.commons.constants.ResourceStatus;
@@ -31,8 +29,8 @@
import org.eclipse.om2m.commons.exceptions.NotPermittedAttrException;
import org.eclipse.om2m.commons.exceptions.Om2mException;
import org.eclipse.om2m.commons.exceptions.ResourceNotFoundException;
-import org.eclipse.om2m.commons.resource.CustomAttribute;
import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.CustomAttribute;
import org.eclipse.om2m.commons.resource.RequestPrimitive;
import org.eclipse.om2m.commons.resource.ResponsePrimitive;
import org.eclipse.om2m.commons.resource.flexcontainerspec.FlexContainerFactory;
@@ -55,9 +53,6 @@
*/
public class FlexContainerController extends Controller {
- /** Logger */
- private static Log LOGGER = LogFactory.getLog(FlexContainerController.class);
-
/**
* Create the resource in the system according to the representation
*/
@@ -273,9 +268,13 @@
flexContainerEntity.setOntologyRef(flexContainer.getOntologyRef());
}
+ // nodeLink O
+ if (flexContainer.getNodeLink() != null) {
+ flexContainerEntity.setNodeLink(flexContainer.getNodeLink());
+ }
+
// custom attributes
for (CustomAttribute ca : flexContainer.getCustomAttributes()) {
-
flexContainerEntity.createOrUpdateCustomAttribute(ca.getCustomAttributeName(),
ca.getCustomAttributeValue());
}
@@ -512,6 +511,11 @@
flexContainerEntity.setOntologyRef(flexContainer.getOntologyRef());
modifiedAttributes.setOntologyRef(flexContainer.getOntologyRef());
}
+ // nodeLink O
+ if (flexContainer.getNodeLink() != null) {
+ flexContainerEntity.setNodeLink(flexContainer.getNodeLink());
+ modifiedAttributes.setNodeLink(flexContainer.getNodeLink());
+ }
// containerDef
if ((flexContainer.getContainerDefinition() != null)
@@ -583,8 +587,10 @@
FlexContainerEntity flexContainerEntity = dbs.getDAOFactory().getFlexContainerDAO().find(transaction,
request.getTo());
if (flexContainerEntity == null) {
+ LOGGER.info("Delete flexCnt: not found");
throw new ResourceNotFoundException("Resource not found");
}
+ LOGGER.info("Delete flexCnt " + flexContainerEntity);
// lock entity
transaction.lock(flexContainerEntity);
@@ -600,6 +606,8 @@
dbs.getDAOFactory().getFlexContainerDAO().delete(transaction, flexContainerEntity);
// commit the transaction & release lock
transaction.commit();
+
+ String nodeLink = flexContainerEntity.getNodeLink();
// deannounce
Announcer.deAnnounce(flexContainerEntity.getAnnounceTo(), flexContainerEntity,
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/MgmtObjAnncController.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/MgmtObjAnncController.java
new file mode 100644
index 0000000..b958852
--- /dev/null
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/MgmtObjAnncController.java
@@ -0,0 +1,465 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 2016 Orange.
+ * 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.om2m.core.controller;
+
+import java.math.BigInteger;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.eclipse.om2m.commons.constants.Constants;
+import org.eclipse.om2m.commons.constants.MgmtDefinitionTypes;
+import org.eclipse.om2m.commons.constants.MimeMediaType;
+import org.eclipse.om2m.commons.constants.ResourceStatus;
+import org.eclipse.om2m.commons.constants.ResourceType;
+import org.eclipse.om2m.commons.constants.ResponseStatusCode;
+import org.eclipse.om2m.commons.constants.ShortName;
+import org.eclipse.om2m.commons.entities.AccessControlPolicyEntity;
+import org.eclipse.om2m.commons.entities.DynamicAuthorizationConsultationEntity;
+import org.eclipse.om2m.commons.entities.MgmtObjAnncEntity;
+import org.eclipse.om2m.commons.entities.NodeEntity;
+import org.eclipse.om2m.commons.entities.ResourceEntity;
+import org.eclipse.om2m.commons.entities.SubscriptionEntity;
+import org.eclipse.om2m.commons.exceptions.BadRequestException;
+import org.eclipse.om2m.commons.exceptions.ConflictException;
+import org.eclipse.om2m.commons.exceptions.NotImplementedException;
+import org.eclipse.om2m.commons.exceptions.ResourceNotFoundException;
+import org.eclipse.om2m.commons.resource.AnnouncedMgmtResource;
+import org.eclipse.om2m.commons.resource.RequestPrimitive;
+import org.eclipse.om2m.commons.resource.ResponsePrimitive;
+import org.eclipse.om2m.commons.utils.Util.DateUtil;
+import org.eclipse.om2m.core.datamapper.DataMapperSelector;
+import org.eclipse.om2m.core.entitymapper.EntityMapperFactory;
+import org.eclipse.om2m.core.notifier.Notifier;
+import org.eclipse.om2m.core.router.Patterns;
+import org.eclipse.om2m.core.urimapper.UriMapper;
+import org.eclipse.om2m.core.util.ControllerUtil;
+import org.eclipse.om2m.persistence.service.DAO;
+
+/**
+ * Controller for the MgmtObj Resource
+ *
+ */
+public class MgmtObjAnncController extends Controller {
+
+ /** Logger */
+ private static Log LOGGER = LogFactory.getLog(MgmtObjAnncController.class);
+
+ /**
+ * Create the resource in the system according to the representation
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public ResponsePrimitive doCreate(RequestPrimitive request) {
+ /*
+ * MgmtObj creation procedure
+ *
+ * @resourceName NP resourceType NP resourceID NP parentID NP
+ * accessControlPolicyIDs O creationTime NP expirationTime O
+ * lastModifiedTime NP labels O announceTo O announcedAttribute O
+ *
+ * creator O maxNrOfInstances O maxByteSize O maxInstanceAge O
+ * currentNrOfInstances NP currentByteSize NP locationID O ontologyRef O
+ *
+ */
+
+ String contentFormat = System.getProperty("org.eclipse.om2m.registration.contentFormat", MimeMediaType.XML);
+ Patterns patterns = new Patterns();
+
+ ResponsePrimitive response = new ResponsePrimitive(request);
+
+ // get the dao of the parent
+ DAO<ResourceEntity> nodeDao = (DAO<ResourceEntity>) patterns.getDAO(request.getTo(), dbs);
+ if (nodeDao == null) {
+ throw new ResourceNotFoundException("Cannot find parent resource");
+ }
+
+ // get the parent entity
+ ResourceEntity parentEntity = (ResourceEntity) nodeDao.find(transaction, request.getTo());
+ // check the parent existence
+ if (parentEntity == null) {
+ throw new ResourceNotFoundException("Cannot find parent resource");
+ }
+
+ // lock parent
+ transaction.lock(parentEntity);
+
+ if (parentEntity.getResourceType().intValue() == (ResourceType.NODE_ANNC)) {
+ throw new NotImplementedException("Parent is Node Annc, not implemented yet.");
+ }
+
+ // parent is Node
+ NodeEntity nodeEntity = (NodeEntity) parentEntity;
+
+ // get lists to change in the method corresponding to specific object
+ List<AccessControlPolicyEntity> acpsToCheck = nodeEntity.getAccessControlPolicies();
+// List<DynamicAuthorizationConsultationEntity> dacsToCheck = null;
+ List<SubscriptionEntity> subscriptions = nodeEntity.getSubscriptions();
+
+ // check access control policy of the originator
+ checkPermissions(request, nodeEntity, acpsToCheck);
+
+ // check if content is present
+ if (request.getContent() == null) {
+ throw new BadRequestException("A content is requiered for MgmtObj creation");
+ }
+ LOGGER.info("contentType: " + request.getRequestContentType());
+ LOGGER.info("content: " + request.getContent());
+ LOGGER.info("parent node: " + nodeEntity);
+ // get the object from the representation
+ AnnouncedMgmtResource mgmtObj = null;
+ try {
+ String payload = null;
+ if (request.getRequestContentType().equals(MimeMediaType.OBJ)) {
+ mgmtObj = (AnnouncedMgmtResource) request.getContent();
+ // need to create the payload in order to validate it
+ payload = DataMapperSelector.getDataMapperList().get(contentFormat).objToString(mgmtObj);
+ } else {
+ mgmtObj = (AnnouncedMgmtResource) DataMapperSelector.getDataMapperList()
+ .get(request.getRequestContentType()).stringToObj((String) request.getContent());
+ if (request.getRequestContentType().equals(contentFormat)) {
+ payload = (String) request.getContent();
+ } else {
+ // need to create the payload in order to validate it
+ payload = DataMapperSelector.getDataMapperList().get(contentFormat).objToString(mgmtObj);
+ }
+ }
+ LOGGER.info("payload: " + payload);
+
+ // validate XML payload
+// if (contentFormat.equals(MimeMediaType.XML)) {
+// FlexContainerXMLValidator.validateXMLPayload(payload, flexContainer.getContainerDefinition());
+// }
+ } catch (ClassCastException e) {
+ e.printStackTrace();
+ LOGGER.info("ClassCastException: Incorrect resource type in object conversion.", e);
+ throw new BadRequestException("Incorrect resource representation in content", e);
+ }
+
+ if (mgmtObj == null) {
+ throw new BadRequestException("Error in provided content");
+ }
+ else LOGGER.info("MgmtObj: " + mgmtObj.getClass() + ": " + mgmtObj);
+
+ BigInteger mgmtDef = mgmtObj.getMgmtDefinition();
+
+ // creating the corresponding entity
+ MgmtObjAnncEntity mgmtObjEntity = MgmtObjAnncEntity.create(mgmtDef);
+
+ ControllerUtil.CreateUtil.fillEntityFromGenericResource(mgmtObj, mgmtObjEntity);
+
+ mgmtObjEntity.fillFrom(mgmtObj);
+
+ String generatedId = generateId("", "");
+ // set name if present and without any conflict
+ if (mgmtObj.getName() != null) {
+ if (! patterns.checkResourceName(mgmtObj.getName())) {
+ throw new BadRequestException("Name provided is incorrect. Must be:" + patterns.ID_STRING);
+ }
+ mgmtObjEntity.setName(mgmtObj.getName());
+ } else {
+ mgmtObjEntity.setName(MgmtDefinitionTypes.getShortName(mgmtDef) + "_" + generatedId);
+ }
+ mgmtObjEntity.setResourceID("/" + Constants.CSE_ID + "/" + ShortName.MGO
+ + Constants.PREFIX_SEPERATOR + generatedId);
+ mgmtObjEntity.setHierarchicalURI(parentEntity.getHierarchicalURI() + "/" + mgmtObjEntity.getName());
+ mgmtObjEntity.setParentID(parentEntity.getResourceID());
+ mgmtObjEntity.setResourceType(ResourceType.MGMT_OBJ);
+
+ // accessControlPolicyIDs O
+ if (! mgmtObj.getAccessControlPolicyIDs().isEmpty()) {
+ mgmtObjEntity.setAccessControlPolicies(
+ ControllerUtil.buildAcpEntityList(mgmtObj.getAccessControlPolicyIDs(), transaction));
+ } else {
+ mgmtObjEntity.getAccessControlPolicies().addAll(acpsToCheck);
+ }
+
+ // dynamicAuthorizationConsultationIDs O
+ if (! mgmtObj.getDynamicAuthorizationConsultationIDs().isEmpty()) {
+ mgmtObjEntity.setDynamicAuthorizationConsultations(
+ ControllerUtil.buildDacEntityList(mgmtObj.getDynamicAuthorizationConsultationIDs(), transaction));
+ }
+
+ if (! UriMapper.addNewUri(mgmtObjEntity.getHierarchicalURI(), mgmtObjEntity.getResourceID(),
+ ResourceType.MGMT_OBJ)) {
+ throw new ConflictException("Name already present in the parent collection.");
+ }
+
+ // create the mgmtObj in the DB
+ LOGGER.info("persist " + mgmtObjEntity + " ");
+ dbs.getDAOFactory().getMgmtObjAnncDAO().create(transaction, mgmtObjEntity);
+ // retrieve the managed object from DB
+ MgmtObjAnncEntity mgmtObjFromDB = dbs.getDAOFactory().getMgmtObjAnncDAO().find(transaction,
+ mgmtObjEntity.getResourceID());
+
+ LOGGER.info("Created entity: " + mgmtObjFromDB);
+
+// nodeEntity.addMgmtObj(mgmtObjFromDB); TODO
+ nodeDao.update(transaction, nodeEntity);
+
+ // update link with mgmtObjEntity - DacEntity
+ for (DynamicAuthorizationConsultationEntity dace : mgmtObjFromDB.getDynamicAuthorizationConsultations()) {
+ DynamicAuthorizationConsultationEntity daceFromDB = dbs.getDAOFactory().getDynamicAuthorizationDAO().find(transaction, dace.getResourceID());
+// daceFromDB.addMgmtObj(mgmtObjFromDB); TODO
+ dbs.getDAOFactory().getDynamicAuthorizationDAO().update(transaction, daceFromDB);
+ }
+
+ // commit the transaction & release lock
+ transaction.commit();
+
+ Notifier.notify(subscriptions, mgmtObjFromDB, ResourceStatus.CHILD_CREATED);
+
+ // create the response
+ response.setResponseStatusCode(ResponseStatusCode.CREATED);
+ // set the location of the resource
+ setLocationAndCreationContent(request, response, mgmtObjFromDB);
+ return response;
+ }
+
+ /**
+ * Return the container resource with the normalized representation
+ *
+ * @param request
+ * primitive routed
+ * @return response primitive
+ */
+ @Override
+ public ResponsePrimitive doRetrieve(RequestPrimitive request) {
+ // Creating the response primitive
+ ResponsePrimitive response = new ResponsePrimitive(request);
+
+ // Check existence of the resource
+ MgmtObjAnncEntity mgmtObjEntity = dbs.getDAOFactory().getMgmtObjAnncDAO().find(transaction,
+ request.getTo());
+ if (mgmtObjEntity == null) {
+ throw new ResourceNotFoundException("Resource not found");
+ }
+
+ // if resource exists, check authorization
+ // retrieve
+ List<AccessControlPolicyEntity> acpList = mgmtObjEntity.getAccessControlPolicies();
+// checkACP(acpList, request.getFrom(), request.getOperation());
+ checkPermissions(request, mgmtObjEntity, mgmtObjEntity.getAccessControlPolicies());
+
+ // Mapping the entity with the exchange resource
+ AnnouncedMgmtResource mgmtObj = (AnnouncedMgmtResource)
+ EntityMapperFactory.getMapperForMgmtObjAnnc()
+ .mapEntityToResource(mgmtObjEntity, request);
+
+ response.setContent(mgmtObj);
+
+ response.setResponseStatusCode(ResponseStatusCode.OK);
+ // return the response
+ return response;
+ }
+
+ /**
+ * Implement the full update method for container entity
+ *
+ * @param request
+ * @return
+ */
+ @Override
+ public ResponsePrimitive doUpdate(RequestPrimitive request) {
+ return processInternalNotifyOrUpdate(request, false);
+ }
+
+ @Override
+ public ResponsePrimitive doInternalNotify(RequestPrimitive request) {
+ return processInternalNotifyOrUpdate(request, true);
+ }
+
+ /**
+ * @param request
+ * @return
+ */
+ private ResponsePrimitive processInternalNotifyOrUpdate(RequestPrimitive request,
+ boolean isInternalNotify) {
+ /*
+ * Container update procedure
+ *
+ * @resourceName NP resourceType NP resourceID NP parentID NP
+ * accessControlPolicyIDs O creationTime NP expirationTime O
+ * lastModifiedTime NP labels O announceTo O announcedAttribute O
+ *
+ * creator NP maxNrOfInstances O maxByteSize O maxInstanceAge O
+ * currentNrOfInstances NP currentByteSize NP locationID O ontologyRef O
+ *
+ */
+ // create the response base
+ String contentFormat = System.getProperty("org.eclipse.om2m.registration.contentFormat", MimeMediaType.XML);
+
+ ResponsePrimitive response = new ResponsePrimitive(request);
+
+ // retrieve the resource from database
+ MgmtObjAnncEntity mgmtObjEntity = dbs.getDAOFactory().getMgmtObjAnncDAO().find(transaction,
+ request.getTo());
+
+ // lock current object
+ transaction.lock(mgmtObjEntity);
+
+ if (mgmtObjEntity == null) {
+ throw new ResourceNotFoundException("Resource not found");
+ }
+ // check ACP
+// checkACP(mgmtObjEntity.getAccessControlPolicies(), request.getFrom(), Operation.UPDATE);
+ if (! isInternalNotify) {
+ checkPermissions(request, mgmtObjEntity, mgmtObjEntity.getAccessControlPolicies());
+ }
+
+ AnnouncedMgmtResource modifiedMgmtObj = (AnnouncedMgmtResource)
+ EntityMapperFactory.getMapperForMgmtObjAnnc()
+ .mapEntityToResource(mgmtObjEntity, request);
+ // check if content is present
+ if (request.getContent() != null) {
+ // create the java object from the resource representation
+ // get the object from the representation
+ AnnouncedMgmtResource mgmtObj = null;
+ try {
+ String payload = null;
+ if (request.getRequestContentType().equals(MimeMediaType.OBJ)) {
+ mgmtObj = (AnnouncedMgmtResource) request.getContent();
+ // need to create the payload in order to validate it
+ payload = DataMapperSelector.getDataMapperList().get(contentFormat)
+ .objToString(mgmtObj);
+
+ } else {
+ mgmtObj = (AnnouncedMgmtResource) DataMapperSelector.getDataMapperList()
+ .get(request.getRequestContentType()).stringToObj((String) request.getContent());
+
+ if (request.getRequestContentType().equals(contentFormat)) {
+ payload = (String) request.getContent();
+ } else {
+ // need to create the XML payload in order to validate
+ // it
+ payload = DataMapperSelector.getDataMapperList().get(contentFormat)
+ .objToString(mgmtObj);
+ }
+ }
+
+// // validate XML payload
+// if (contentFormat.equals(MimeMediaType.XML)) {
+// FlexContainerXMLValidator.validateXMLPayload(payload, mgmtObj.getContainerDefinition());
+// }
+
+ } catch (ClassCastException e) {
+ throw new BadRequestException("Incorrect resource representation in content", e);
+ }
+ if (mgmtObj == null) {
+ throw new BadRequestException("Error in provided content");
+ }
+
+ // check attributes, NP attributes are ignored
+ // @resourceName NP
+ // resourceType NP
+ // resourceID NP
+ // parentID NP
+ // creationTime NP
+ // creator NP
+ // lastModifiedTime NP
+ // currentNrOfInstances NP
+ // currentByteSize NP
+
+ // labels O
+ // accessControlPolicyIDs O
+ if (! mgmtObj.getAccessControlPolicyIDs().isEmpty()) {
+ mgmtObjEntity.getAccessControlPolicies().clear();
+ mgmtObjEntity.setAccessControlPolicies(
+ ControllerUtil.buildAcpEntityList(mgmtObj.getAccessControlPolicyIDs(), transaction));
+ modifiedMgmtObj.getAccessControlPolicyIDs().addAll(mgmtObj.getAccessControlPolicyIDs());
+ }
+
+ // dynamicAuthorizationConsultationIDs O
+ if (! mgmtObj.getDynamicAuthorizationConsultationIDs().isEmpty()) {
+ mgmtObjEntity.setDynamicAuthorizationConsultations(
+ ControllerUtil.buildDacEntityList(mgmtObj.getDynamicAuthorizationConsultationIDs(), transaction));
+
+ // update link with mgmtObjEntity - DacEntity
+ for(DynamicAuthorizationConsultationEntity dace : mgmtObjEntity.getDynamicAuthorizationConsultations()) {
+ DynamicAuthorizationConsultationEntity daceFromDB = dbs.getDAOFactory().getDynamicAuthorizationDAO().find(transaction, dace.getResourceID());
+// if (mgmtObj instanceof DeviceInfo) TODO
+// daceFromDB.getLinkedDeviceInfoEntities().add((DeviceInfoEntity) mgmtObjEntity);
+// else if (mgmtObj instanceof AreaNwkDeviceInfo)
+// daceFromDB.getLinkedAreaNwkDeviceInfoEntities().add((AreaNwkDeviceInfoEntity) mgmtObjEntity);
+// else if (mgmtObj instanceof AreaNwkInfo)
+// daceFromDB.getLinkedAreaNwkInfoEntities().add((AreaNwkInfoEntity) mgmtObjEntity);
+ dbs.getDAOFactory().getDynamicAuthorizationDAO().update(transaction, daceFromDB);
+ }
+ }
+
+ // labels O
+ if (! mgmtObj.getLabels().isEmpty()) {
+ mgmtObjEntity.setLabelsEntitiesFromSring(mgmtObj.getLabels());
+ modifiedMgmtObj.getLabels().addAll(mgmtObj.getLabels());
+ }
+ // expirationTime O
+ if (mgmtObj.getExpirationTime() != null) {
+ mgmtObjEntity.setExpirationTime(mgmtObj.getExpirationTime());
+ modifiedMgmtObj.setExpirationTime(mgmtObj.getExpirationTime());
+ }
+
+ // mgmtDefinition
+ if ((mgmtObj.getMgmtDefinition() != null)
+ && ! mgmtObjEntity.getMgmtDefinition().equals(mgmtObj.getMgmtDefinition())) {
+ throw new BadRequestException("unable to change the mgmtDefinition value");
+ }
+ }
+
+ mgmtObjEntity.setLastModifiedTime(DateUtil.now());
+ modifiedMgmtObj.setLastModifiedTime(mgmtObjEntity.getLastModifiedTime());
+
+ response.setContent(modifiedMgmtObj);
+ // update the resource in the database
+ dbs.getDAOFactory().getMgmtObjAnncDAO().update(transaction, mgmtObjEntity);
+
+ // commit and release lock
+ transaction.commit();
+
+ Notifier.notify(mgmtObjEntity.getSubscriptions(), mgmtObjEntity, modifiedMgmtObj,
+ ResourceStatus.UPDATED);
+
+ // set response status code
+ response.setResponseStatusCode(ResponseStatusCode.UPDATED);
+ return response;
+ }
+
+ /**
+ * Delete the container if access control policies are correct
+ */
+ @Override
+ public ResponsePrimitive doDelete(RequestPrimitive request) {
+ // Generic delete procedure
+ ResponsePrimitive response = new ResponsePrimitive(request);
+
+ // retrieve the corresponding resource from database
+ MgmtObjAnncEntity mgmtObjEntity = dbs.getDAOFactory().getMgmtObjAnncDAO().find(transaction,
+ request.getTo());
+ if (mgmtObjEntity == null) {
+ throw new ResourceNotFoundException("Resource not found");
+ }
+
+ // lock entity
+ transaction.lock(mgmtObjEntity);
+
+ // check access control policies
+ checkPermissions(request, mgmtObjEntity, mgmtObjEntity.getAccessControlPolicies());
+
+ UriMapper.deleteUri(mgmtObjEntity.getHierarchicalURI());
+ Notifier.notifyDeletion(mgmtObjEntity.getSubscriptions(), mgmtObjEntity);
+
+ // delete the resource in the database
+ dbs.getDAOFactory().getMgmtObjAnncDAO().delete(transaction, mgmtObjEntity);
+ // commit the transaction & release lock
+ transaction.commit();
+
+ // return the response
+ response.setResponseStatusCode(ResponseStatusCode.DELETED);
+ return response;
+ }
+
+}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/MgmtObjController.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/MgmtObjController.java
new file mode 100644
index 0000000..d4f63f8
--- /dev/null
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/MgmtObjController.java
@@ -0,0 +1,487 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 2016 Orange.
+ * 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.om2m.core.controller;
+
+import java.math.BigInteger;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.eclipse.om2m.commons.constants.Constants;
+import org.eclipse.om2m.commons.constants.MgmtDefinitionTypes;
+import org.eclipse.om2m.commons.constants.MimeMediaType;
+import org.eclipse.om2m.commons.constants.ResourceStatus;
+import org.eclipse.om2m.commons.constants.ResourceType;
+import org.eclipse.om2m.commons.constants.ResponseStatusCode;
+import org.eclipse.om2m.commons.constants.ShortName;
+import org.eclipse.om2m.commons.entities.AccessControlPolicyEntity;
+import org.eclipse.om2m.commons.entities.DynamicAuthorizationConsultationEntity;
+import org.eclipse.om2m.commons.entities.MgmtObjEntity;
+import org.eclipse.om2m.commons.entities.NodeEntity;
+import org.eclipse.om2m.commons.entities.ResourceEntity;
+import org.eclipse.om2m.commons.entities.SubscriptionEntity;
+import org.eclipse.om2m.commons.exceptions.BadRequestException;
+import org.eclipse.om2m.commons.exceptions.ConflictException;
+import org.eclipse.om2m.commons.exceptions.NotImplementedException;
+import org.eclipse.om2m.commons.exceptions.ResourceNotFoundException;
+import org.eclipse.om2m.commons.resource.MgmtObj;
+import org.eclipse.om2m.commons.resource.RequestPrimitive;
+import org.eclipse.om2m.commons.resource.ResponsePrimitive;
+import org.eclipse.om2m.commons.utils.Util.DateUtil;
+import org.eclipse.om2m.core.announcer.Announcer;
+import org.eclipse.om2m.core.datamapper.DataMapperSelector;
+import org.eclipse.om2m.core.entitymapper.EntityMapperFactory;
+import org.eclipse.om2m.core.notifier.Notifier;
+import org.eclipse.om2m.core.router.Patterns;
+import org.eclipse.om2m.core.urimapper.UriMapper;
+import org.eclipse.om2m.core.util.ControllerUtil;
+import org.eclipse.om2m.persistence.service.DAO;
+
+/**
+ * Controller for the MgmtObj Resource
+ *
+ */
+public class MgmtObjController extends Controller {
+
+ /** Logger */
+ private static Log LOGGER = LogFactory.getLog(MgmtObjController.class);
+
+ /**
+ * Create the resource in the system according to the representation
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public ResponsePrimitive doCreate(RequestPrimitive request) {
+ /*
+ * MgmtObj creation procedure
+ *
+ * @resourceName NP resourceType NP resourceID NP parentID NP
+ * accessControlPolicyIDs O creationTime NP expirationTime O
+ * lastModifiedTime NP labels O announceTo O announcedAttribute O
+ *
+ * creator O maxNrOfInstances O maxByteSize O maxInstanceAge O
+ * currentNrOfInstances NP currentByteSize NP locationID O ontologyRef O
+ *
+ */
+
+ String contentFormat = System.getProperty("org.eclipse.om2m.registration.contentFormat", MimeMediaType.XML);
+ Patterns patterns = new Patterns();
+
+ ResponsePrimitive response = new ResponsePrimitive(request);
+
+ // get the dao of the parent
+ DAO<ResourceEntity> nodeDao = (DAO<ResourceEntity>) patterns.getDAO(request.getTo(), dbs);
+ if (nodeDao == null) {
+ throw new ResourceNotFoundException("Cannot find parent resource");
+ }
+
+ // get the parent entity
+ ResourceEntity parentEntity = (ResourceEntity) nodeDao.find(transaction, request.getTo());
+ // check the parent existence
+ if (parentEntity == null) {
+ throw new ResourceNotFoundException("Cannot find parent resource");
+ }
+
+ // lock parent
+ transaction.lock(parentEntity);
+
+ if (parentEntity.getResourceType().intValue() == (ResourceType.NODE_ANNC)) {
+ throw new NotImplementedException("Parent is Node Annc, not implemented yet.");
+ }
+
+ // parent is Node
+ NodeEntity nodeEntity = (NodeEntity) parentEntity;
+
+ // get lists to change in the method corresponding to specific object
+ List<AccessControlPolicyEntity> acpsToCheck = nodeEntity.getAccessControlPolicies();
+// List<DynamicAuthorizationConsultationEntity> dacsToCheck = null;
+ List<SubscriptionEntity> subscriptions = nodeEntity.getSubscriptions();
+
+ // check access control policy of the originator
+ checkPermissions(request, nodeEntity, acpsToCheck);
+
+ // check if content is present
+ if (request.getContent() == null) {
+ throw new BadRequestException("A content is requiered for MgmtObj creation");
+ }
+ LOGGER.info("contentType: " + request.getRequestContentType());
+ LOGGER.info("content: " + request.getContent());
+ LOGGER.info("parent node: " + nodeEntity);
+ // get the object from the representation
+ MgmtObj mgmtObj = null;
+ try {
+ String payload = null;
+ if (request.getRequestContentType().equals(MimeMediaType.OBJ)) {
+ mgmtObj = (MgmtObj) request.getContent();
+ // need to create the payload in order to validate it
+ payload = DataMapperSelector.getDataMapperList().get(contentFormat).objToString(mgmtObj);
+ } else {
+ mgmtObj = (MgmtObj) DataMapperSelector.getDataMapperList()
+ .get(request.getRequestContentType()).stringToObj((String) request.getContent());
+ if (request.getRequestContentType().equals(contentFormat)) {
+ payload = (String) request.getContent();
+ } else {
+ // need to create the payload in order to validate it
+ payload = DataMapperSelector.getDataMapperList().get(contentFormat).objToString(mgmtObj);
+ }
+ }
+ LOGGER.info("payload: " + payload);
+
+ // validate XML payload
+// if (contentFormat.equals(MimeMediaType.XML)) {
+// FlexContainerXMLValidator.validateXMLPayload(payload, flexContainer.getContainerDefinition());
+// }
+ } catch (ClassCastException e) {
+ e.printStackTrace();
+ LOGGER.info("ClassCastException: Incorrect resource type in object conversion.", e);
+ throw new BadRequestException("Incorrect resource representation in content", e);
+ }
+
+ if (mgmtObj == null) {
+ throw new BadRequestException("Error in provided content");
+ }
+ else LOGGER.info("MgmtObj: " + mgmtObj.getClass() + ": " + mgmtObj);
+
+ BigInteger mgmtDef = mgmtObj.getMgmtDefinition();
+
+ // creating the corresponding entity
+ MgmtObjEntity mgmtObjEntity = MgmtObjEntity.create(mgmtDef);
+
+ ControllerUtil.CreateUtil.fillEntityFromAnnounceableResource(mgmtObj, mgmtObjEntity);
+
+ mgmtObjEntity.fillFrom(mgmtObj);
+
+ String generatedId = generateId("", "");
+ // set name if present and without any conflict
+ if (mgmtObj.getName() != null) {
+ if (! patterns.checkResourceName(mgmtObj.getName())) {
+ throw new BadRequestException("Name provided is incorrect. Must be:" + patterns.ID_STRING);
+ }
+ mgmtObjEntity.setName(mgmtObj.getName());
+ } else {
+ mgmtObjEntity.setName(MgmtDefinitionTypes.getShortName(mgmtDef) + "_" + generatedId);
+ }
+ mgmtObjEntity.setResourceID("/" + Constants.CSE_ID + "/" + ShortName.MGO
+ + Constants.PREFIX_SEPERATOR + generatedId);
+ mgmtObjEntity.setHierarchicalURI(parentEntity.getHierarchicalURI() + "/" + mgmtObjEntity.getName());
+ mgmtObjEntity.setParentID(parentEntity.getResourceID());
+ mgmtObjEntity.setResourceType(ResourceType.MGMT_OBJ);
+
+ // accessControlPolicyIDs O
+ if (! mgmtObj.getAccessControlPolicyIDs().isEmpty()) {
+ mgmtObjEntity.setAccessControlPolicies(
+ ControllerUtil.buildAcpEntityList(mgmtObj.getAccessControlPolicyIDs(), transaction));
+ } else {
+ mgmtObjEntity.getAccessControlPolicies().addAll(acpsToCheck);
+ }
+
+ // dynamicAuthorizationConsultationIDs O
+ if (! mgmtObj.getDynamicAuthorizationConsultationIDs().isEmpty()) {
+ mgmtObjEntity.setDynamicAuthorizationConsultations(
+ ControllerUtil.buildDacEntityList(mgmtObj.getDynamicAuthorizationConsultationIDs(), transaction));
+ }
+
+ if (! UriMapper.addNewUri(mgmtObjEntity.getHierarchicalURI(), mgmtObjEntity.getResourceID(),
+ ResourceType.MGMT_OBJ)) {
+ throw new ConflictException("Name already present in the parent collection.");
+ }
+
+ // create the mgmtObj in the DB
+ LOGGER.info("persist " + mgmtObjEntity + " ");
+ dbs.getDAOFactory().getMgmtObjDAO().create(transaction, mgmtObjEntity);
+ // retrieve the managed object from DB
+ MgmtObjEntity mgmtObjFromDB = dbs.getDAOFactory().getMgmtObjDAO().find(transaction,
+ mgmtObjEntity.getResourceID());
+
+ LOGGER.info("Created entity: " + mgmtObjFromDB);
+
+ nodeEntity.addMgmtObj(mgmtObjFromDB);
+ nodeDao.update(transaction, nodeEntity);
+
+ // update link with mgmtObjEntity - DacEntity
+ for (DynamicAuthorizationConsultationEntity dace : mgmtObjFromDB.getDynamicAuthorizationConsultations()) {
+ DynamicAuthorizationConsultationEntity daceFromDB = dbs.getDAOFactory().getDynamicAuthorizationDAO().find(transaction, dace.getResourceID());
+ daceFromDB.addMgmtObj(mgmtObjFromDB);
+ dbs.getDAOFactory().getDynamicAuthorizationDAO().update(transaction, daceFromDB);
+ }
+
+ // commit the transaction & release lock
+ transaction.commit();
+
+ if ((mgmtObj.getAnnounceTo() != null) && ! mgmtObj.getAnnounceTo().isEmpty()) {
+ mgmtObj.setName(mgmtObjFromDB.getName());
+ mgmtObj.setResourceID(mgmtObjFromDB.getResourceID());
+ mgmtObj.setResourceType(ResourceType.MGMT_OBJ);
+ mgmtObj.setParentID(mgmtObjFromDB.getParentID());
+ String hierachicalURI = mgmtObjFromDB.getHierarchicalURI();
+ String remoteLocation = hierachicalURI
+ .substring(("/" + Constants.CSE_ID + "/" + Constants.CSE_NAME + "/").length());
+ Announcer.announce(mgmtObj.getAnnounceTo(), mgmtObj.getAnnouncedAttribute(), mgmtObj,
+ request.getFrom(), remoteLocation);
+ }
+
+ Notifier.notify(subscriptions, mgmtObjFromDB, ResourceStatus.CHILD_CREATED);
+
+ // create the response
+ response.setResponseStatusCode(ResponseStatusCode.CREATED);
+ // set the location of the resource
+ setLocationAndCreationContent(request, response, mgmtObjFromDB);
+ return response;
+ }
+
+ /**
+ * Return the container resource with the normalized representation
+ *
+ * @param request
+ * primitive routed
+ * @return response primitive
+ */
+ @Override
+ public ResponsePrimitive doRetrieve(RequestPrimitive request) {
+ // Creating the response primitive
+ ResponsePrimitive response = new ResponsePrimitive(request);
+
+ // Check existence of the resource
+ MgmtObjEntity mgmtObjEntity = dbs.getDAOFactory().getMgmtObjDAO().find(transaction,
+ request.getTo());
+ if (mgmtObjEntity == null) {
+ throw new ResourceNotFoundException("Resource not found");
+ }
+
+ // if resource exists, check authorization
+ // retrieve
+ List<AccessControlPolicyEntity> acpList = mgmtObjEntity.getAccessControlPolicies();
+// checkACP(acpList, request.getFrom(), request.getOperation());
+ checkPermissions(request, mgmtObjEntity, mgmtObjEntity.getAccessControlPolicies());
+
+ // Mapping the entity with the exchange resource
+ MgmtObj mgmtObj = (MgmtObj) EntityMapperFactory.getMapperForMgmtObj()
+ .mapEntityToResource(mgmtObjEntity, request);
+
+ response.setContent(mgmtObj);
+
+ response.setResponseStatusCode(ResponseStatusCode.OK);
+ // return the response
+ return response;
+ }
+
+ /**
+ * Implement the full update method for container entity
+ *
+ * @param request
+ * @return
+ */
+ @Override
+ public ResponsePrimitive doUpdate(RequestPrimitive request) {
+ return processInternalNotifyOrUpdate(request, false);
+ }
+
+ @Override
+ public ResponsePrimitive doInternalNotify(RequestPrimitive request) {
+ return processInternalNotifyOrUpdate(request, true);
+ }
+
+ /**
+ * @param request
+ * @return
+ */
+ private ResponsePrimitive processInternalNotifyOrUpdate(RequestPrimitive request,
+ boolean isInternalNotify) {
+ /*
+ * Container update procedure
+ *
+ * @resourceName NP resourceType NP resourceID NP parentID NP
+ * accessControlPolicyIDs O creationTime NP expirationTime O
+ * lastModifiedTime NP labels O announceTo O announcedAttribute O
+ *
+ * creator NP maxNrOfInstances O maxByteSize O maxInstanceAge O
+ * currentNrOfInstances NP currentByteSize NP locationID O ontologyRef O
+ *
+ */
+ // create the response base
+ String contentFormat = System.getProperty("org.eclipse.om2m.registration.contentFormat", MimeMediaType.XML);
+
+ ResponsePrimitive response = new ResponsePrimitive(request);
+
+ // retrieve the resource from database
+ MgmtObjEntity mgmtObjEntity = dbs.getDAOFactory().getMgmtObjDAO().find(transaction,
+ request.getTo());
+
+ // lock current object
+ transaction.lock(mgmtObjEntity);
+
+ if (mgmtObjEntity == null) {
+ throw new ResourceNotFoundException("Resource not found");
+ }
+ // check ACP
+// checkACP(mgmtObjEntity.getAccessControlPolicies(), request.getFrom(), Operation.UPDATE);
+ if (! isInternalNotify) {
+ checkPermissions(request, mgmtObjEntity, mgmtObjEntity.getAccessControlPolicies());
+ }
+
+ MgmtObj modifiedMgmtObj = (MgmtObj) EntityMapperFactory.getMapperForMgmtObj()
+ .mapEntityToResource(mgmtObjEntity, request);
+ // check if content is present
+ if (request.getContent() != null) {
+ // create the java object from the resource representation
+ // get the object from the representation
+ MgmtObj mgmtObj = null;
+ try {
+ String payload = null;
+ if (request.getRequestContentType().equals(MimeMediaType.OBJ)) {
+ mgmtObj = (MgmtObj) request.getContent();
+ // need to create the payload in order to validate it
+ payload = DataMapperSelector.getDataMapperList().get(contentFormat)
+ .objToString(mgmtObj);
+
+ } else {
+ mgmtObj = (MgmtObj) DataMapperSelector.getDataMapperList()
+ .get(request.getRequestContentType()).stringToObj((String) request.getContent());
+
+ if (request.getRequestContentType().equals(contentFormat)) {
+ payload = (String) request.getContent();
+ } else {
+ // need to create the XML payload in order to validate
+ // it
+ payload = DataMapperSelector.getDataMapperList().get(contentFormat)
+ .objToString(mgmtObj);
+ }
+ }
+
+// // validate XML payload
+// if (contentFormat.equals(MimeMediaType.XML)) {
+// FlexContainerXMLValidator.validateXMLPayload(payload, mgmtObj.getContainerDefinition());
+// }
+
+ } catch (ClassCastException e) {
+ throw new BadRequestException("Incorrect resource representation in content", e);
+ }
+ if (mgmtObj == null) {
+ throw new BadRequestException("Error in provided content");
+ }
+
+ // check attributes, NP attributes are ignored
+ // @resourceName NP
+ // resourceType NP
+ // resourceID NP
+ // parentID NP
+ // creationTime NP
+ // creator NP
+ // lastModifiedTime NP
+ // currentNrOfInstances NP
+ // currentByteSize NP
+
+ // labels O
+ // accessControlPolicyIDs O
+ if (! mgmtObj.getAccessControlPolicyIDs().isEmpty()) {
+ mgmtObjEntity.getAccessControlPolicies().clear();
+ mgmtObjEntity.setAccessControlPolicies(
+ ControllerUtil.buildAcpEntityList(mgmtObj.getAccessControlPolicyIDs(), transaction));
+ modifiedMgmtObj.getAccessControlPolicyIDs().addAll(mgmtObj.getAccessControlPolicyIDs());
+ }
+
+ // dynamicAuthorizationConsultationIDs O
+ if (! mgmtObj.getDynamicAuthorizationConsultationIDs().isEmpty()) {
+ mgmtObjEntity.setDynamicAuthorizationConsultations(
+ ControllerUtil.buildDacEntityList(mgmtObj.getDynamicAuthorizationConsultationIDs(), transaction));
+
+ // update link with mgmtObjEntity - DacEntity
+ for(DynamicAuthorizationConsultationEntity dace : mgmtObjEntity.getDynamicAuthorizationConsultations()) {
+ DynamicAuthorizationConsultationEntity daceFromDB = dbs.getDAOFactory().getDynamicAuthorizationDAO().find(transaction, dace.getResourceID());
+ daceFromDB.addMgmtObj(mgmtObjEntity);
+ dbs.getDAOFactory().getDynamicAuthorizationDAO().update(transaction, daceFromDB);
+ }
+ }
+
+ // labels O
+ if (! mgmtObj.getLabels().isEmpty()) {
+ mgmtObjEntity.setLabelsEntitiesFromSring(mgmtObj.getLabels());
+ modifiedMgmtObj.getLabels().addAll(mgmtObj.getLabels());
+ }
+ // expirationTime O
+ if (mgmtObj.getExpirationTime() != null) {
+ mgmtObjEntity.setExpirationTime(mgmtObj.getExpirationTime());
+ modifiedMgmtObj.setExpirationTime(mgmtObj.getExpirationTime());
+ }
+ // announceTo O
+ if (! mgmtObj.getAnnounceTo().isEmpty()) {
+ mgmtObjEntity.getAnnounceTo().clear();
+ mgmtObjEntity.getAnnounceTo().addAll(mgmtObj.getAnnounceTo());
+ modifiedMgmtObj.getAnnounceTo().addAll(mgmtObj.getAnnounceTo());
+ }
+ // announcedAttribute O
+ if (! mgmtObj.getAnnouncedAttribute().isEmpty()) {
+ mgmtObjEntity.getAnnouncedAttribute().clear();
+ mgmtObjEntity.getAnnouncedAttribute().addAll(mgmtObj.getAnnouncedAttribute());
+ modifiedMgmtObj.getAnnouncedAttribute().addAll(mgmtObj.getAnnouncedAttribute());
+ }
+
+ // mgmtDefinition
+ if ((mgmtObj.getMgmtDefinition() != null)
+ && ! mgmtObjEntity.getMgmtDefinition().equals(mgmtObj.getMgmtDefinition())) {
+ throw new BadRequestException("unable to change the mgmtDefinition value");
+ }
+ }
+
+ mgmtObjEntity.setLastModifiedTime(DateUtil.now());
+ modifiedMgmtObj.setLastModifiedTime(mgmtObjEntity.getLastModifiedTime());
+
+ response.setContent(modifiedMgmtObj);
+ // update the resource in the database
+ dbs.getDAOFactory().getMgmtObjDAO().update(transaction, mgmtObjEntity);
+
+ // commit and release lock
+ transaction.commit();
+
+ Notifier.notify(mgmtObjEntity.getSubscriptions(), mgmtObjEntity, modifiedMgmtObj,
+ ResourceStatus.UPDATED);
+
+ // set response status code
+ response.setResponseStatusCode(ResponseStatusCode.UPDATED);
+ return response;
+ }
+
+ /**
+ * Delete the container if access control policies are correct
+ */
+ @Override
+ public ResponsePrimitive doDelete(RequestPrimitive request) {
+ // Generic delete procedure
+ ResponsePrimitive response = new ResponsePrimitive(request);
+
+ // retrieve the corresponding resource from database
+ MgmtObjEntity mgmtObjEntity = dbs.getDAOFactory().getMgmtObjDAO().find(transaction,
+ request.getTo());
+ if (mgmtObjEntity == null) {
+ throw new ResourceNotFoundException("Resource not found");
+ }
+
+ // lock entity
+ transaction.lock(mgmtObjEntity);
+
+ // check access control policies
+ checkPermissions(request, mgmtObjEntity, mgmtObjEntity.getAccessControlPolicies());
+
+ UriMapper.deleteUri(mgmtObjEntity.getHierarchicalURI());
+ Notifier.notifyDeletion(mgmtObjEntity.getSubscriptions(), mgmtObjEntity);
+
+ // delete the resource in the database
+ dbs.getDAOFactory().getMgmtObjDAO().delete(transaction, mgmtObjEntity);
+ // commit the transaction & release lock
+ transaction.commit();
+
+ // deannounce
+ Announcer.deAnnounce(mgmtObjEntity.getAnnounceTo(), mgmtObjEntity,
+ Constants.ADMIN_REQUESTING_ENTITY);
+
+ // return the response
+ response.setResponseStatusCode(ResponseStatusCode.DELETED);
+ return response;
+ }
+
+}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/NodeController.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/NodeController.java
index 5a4b9ce..3f88947 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/NodeController.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/NodeController.java
@@ -154,6 +154,9 @@
if (node.getHostedCSELink() != null) {
nodeEntity.setHostedCSELink(node.getHostedCSELink());
}
+ if (node.getHostedAppLinks() != null) {
+ nodeEntity.setHostedAppLink(node.getHostedAppLinks());
+ }
String generatedId = generateId();
nodeEntity.setResourceID("/" + Constants.CSE_ID + "/" + ShortName.NODE + Constants.PREFIX_SEPERATOR + generatedId);;
@@ -184,10 +187,10 @@
throw new ConflictException("Name already present in the parent collection.");
}
// persisting data
- dbs.getDAOFactory().getNodeEntityDAO().create(transaction, nodeEntity);
+ dbs.getDAOFactory().getNodeDAO().create(transaction, nodeEntity);
// get the manage object
- NodeEntity nodeDB = dbs.getDAOFactory().getNodeEntityDAO().find(transaction, nodeEntity.getResourceID());
+ NodeEntity nodeDB = dbs.getDAOFactory().getNodeDAO().find(transaction, nodeEntity.getResourceID());
childNodes.add(nodeDB);
dao.update(transaction, parentEntity);
transaction.commit();
@@ -319,10 +322,10 @@
response.setContent(modifiedAttributes);
// uptade the persisted resource
- dbs.getDAOFactory().getNodeEntityDAO().update(transaction, nodeEntity);
+ dbs.getDAOFactory().getNodeDAO().update(transaction, nodeEntity);
// commit & close the db transaction
transaction.commit();
- Notifier.notify(nodeEntity.getChildSubscriptions(), nodeEntity, ResourceStatus.UPDATED);
+ Notifier.notify(nodeEntity.getSubscriptions(), nodeEntity, ResourceStatus.UPDATED);
// set response status code
response.setResponseStatusCode(ResponseStatusCode.UPDATED);
@@ -333,21 +336,22 @@
public ResponsePrimitive doDelete(RequestPrimitive request) {
// Generic delete procedure
ResponsePrimitive response = new ResponsePrimitive(request);
-
// retrieve the entity
NodeEntity nodeEntity = dbs.getDAOFactory().getNodeEntityDAO().find(transaction, request.getTo());
if (nodeEntity == null) {
+ LOGGER.info("Delete node: not found");
throw new ResourceNotFoundException();
}
+ LOGGER.info("Delete node " + nodeEntity);
// check access control policies
checkACP(nodeEntity.getAccessControlPolicies(), request.getFrom(), Operation.DELETE);
UriMapper.deleteUri(nodeEntity.getHierarchicalURI());
- Notifier.notifyDeletion(nodeEntity.getChildSubscriptions(), nodeEntity);
+ Notifier.notifyDeletion(nodeEntity.getSubscriptions(), nodeEntity);
// delete the resource in the database
- dbs.getDAOFactory().getNodeEntityDAO().delete(transaction, nodeEntity);
+ dbs.getDAOFactory().getNodeDAO().delete(transaction, nodeEntity);
// commit the transaction
transaction.commit();
// return the response
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/RemoteCSEController.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/RemoteCSEController.java
index e639ef6..174615e 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/RemoteCSEController.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/RemoteCSEController.java
@@ -48,15 +48,12 @@
import org.eclipse.om2m.core.datamapper.DataMapperSelector;
import org.eclipse.om2m.core.entitymapper.EntityMapperFactory;
import org.eclipse.om2m.core.notifier.Notifier;
-import org.eclipse.om2m.core.persistence.PersistenceService;
import org.eclipse.om2m.core.remotecse.RemoteCseService;
import org.eclipse.om2m.core.router.Patterns;
import org.eclipse.om2m.core.urimapper.UriMapper;
import org.eclipse.om2m.core.util.ControllerUtil;
import org.eclipse.om2m.core.util.ControllerUtil.UpdateUtil;
import org.eclipse.om2m.persistence.service.DAO;
-import org.eclipse.om2m.persistence.service.DBService;
-import org.eclipse.om2m.persistence.service.DBTransaction;
/**
* Controller for remote CSE
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AcpMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AcpMapper.java
index b0ec424..f67aabe 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AcpMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AcpMapper.java
@@ -19,7 +19,6 @@
*******************************************************************************/
package org.eclipse.om2m.core.entitymapper;
-import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AeAnncMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AeAnncMapper.java
index 142861f..6433541 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AeAnncMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AeAnncMapper.java
@@ -13,18 +13,12 @@
import org.eclipse.om2m.commons.constants.ResourceType;
import org.eclipse.om2m.commons.constants.ResultContent;
-import org.eclipse.om2m.commons.entities.AccessControlPolicyEntity;
import org.eclipse.om2m.commons.entities.AeAnncEntity;
-import org.eclipse.om2m.commons.entities.ContainerEntity;
import org.eclipse.om2m.commons.entities.FlexContainerAnncEntity;
-import org.eclipse.om2m.commons.entities.FlexContainerEntity;
import org.eclipse.om2m.commons.entities.SubscriptionEntity;
import org.eclipse.om2m.commons.resource.AEAnnc;
-import org.eclipse.om2m.commons.resource.AccessControlPolicy;
-import org.eclipse.om2m.commons.resource.ChildResourceRef;
-import org.eclipse.om2m.commons.resource.Container;
-import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.ChildResourceRef;
import org.eclipse.om2m.commons.resource.Subscription;
public class AeAnncMapper extends EntityMapper<AeAnncEntity, AEAnnc> {
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AeMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AeMapper.java
index 60992bf..01047ac 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AeMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AeMapper.java
@@ -34,11 +34,11 @@
import org.eclipse.om2m.commons.entities.PollingChannelEntity;
import org.eclipse.om2m.commons.entities.SubscriptionEntity;
import org.eclipse.om2m.commons.resource.AE;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
import org.eclipse.om2m.commons.resource.AccessControlPolicy;
import org.eclipse.om2m.commons.resource.ChildResourceRef;
import org.eclipse.om2m.commons.resource.Container;
import org.eclipse.om2m.commons.resource.DynamicAuthorizationConsultation;
-import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
import org.eclipse.om2m.commons.resource.Group;
import org.eclipse.om2m.commons.resource.PollingChannel;
import org.eclipse.om2m.commons.resource.Subscription;
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AreaNwkDeviceInfoMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AreaNwkDeviceInfoMapper.java
deleted file mode 100644
index 465eaac..0000000
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AreaNwkDeviceInfoMapper.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013-2016 LAAS-CNRS (www.laas.fr)
- * 7 Colonel Roche 31077 Toulouse - France
- *
- * 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
- *
- * Initial Contributors:
- * Thierry Monteil : Project manager, technical co-manager
- * Mahdi Ben Alaya : Technical co-manager
- * Samir Medjiah : Technical co-manager
- * Khalil Drira : Strategy expert
- * Guillaume Garzone : Developer
- * François Aïssaoui : Developer
- *
- * New contributors :
- *******************************************************************************/
-package org.eclipse.om2m.core.entitymapper;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.om2m.commons.entities.AreaNwkDeviceInfoEntity;
-import org.eclipse.om2m.commons.resource.AreaNwkDeviceInfo;
-import org.eclipse.om2m.commons.resource.ChildResourceRef;
-
-/**
- * Mapper for AreaNwkDeviceInfo
- *
- */
-public class AreaNwkDeviceInfoMapper extends EntityMapper<AreaNwkDeviceInfoEntity, AreaNwkDeviceInfo> {
-
- @Override
- protected void mapAttributes(AreaNwkDeviceInfoEntity entity,
- AreaNwkDeviceInfo resource, int level, int offset) {
- if (level < 0) {
- return;
- }
-
- // Announceable resource attributes
- EntityMapperFactory.getAnnounceableSubordonateEntity_AnnounceableResourceMapper().mapAttributes(entity, resource, level, offset);
-
- // AreaNwkDeviceInfo attributes
- resource.setAreaNwkId(entity.getAreaNwkId());
- resource.setDescription(entity.getDescription());
- resource.setDevID(entity.getDevID());
- resource.setMgmtDefinition(entity.getMgmtDefinition());
- resource.setName(entity.getName());
- resource.setSleepDuration(entity.getSleepDuration());
- resource.setSleepInterval(entity.getSleepInterval());
- resource.setStatus(entity.getStatus());
- }
-
- @Override
- protected List<ChildResourceRef> getChildResourceRef(AreaNwkDeviceInfoEntity entity, int level, int offset) {
- return new ArrayList<>();
- }
-
- @Override
- protected void mapChildResourceRef(AreaNwkDeviceInfoEntity entity,
- AreaNwkDeviceInfo resource, int level, int offset) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- protected void mapChildResources(AreaNwkDeviceInfoEntity entity,
- AreaNwkDeviceInfo resource, int level, int offset) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- protected AreaNwkDeviceInfo createResource() {
- return new AreaNwkDeviceInfo();
- }
-
-
-
-}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AreaNwkInfoMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AreaNwkInfoMapper.java
deleted file mode 100644
index 53dd9b7..0000000
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AreaNwkInfoMapper.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013-2016 LAAS-CNRS (www.laas.fr)
- * 7 Colonel Roche 31077 Toulouse - France
- *
- * 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
- *
- * Initial Contributors:
- * Thierry Monteil : Project manager, technical co-manager
- * Mahdi Ben Alaya : Technical co-manager
- * Samir Medjiah : Technical co-manager
- * Khalil Drira : Strategy expert
- * Guillaume Garzone : Developer
- * François Aïssaoui : Developer
- *
- * New contributors :
- *******************************************************************************/
-package org.eclipse.om2m.core.entitymapper;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.om2m.commons.entities.AreaNwkInfoEntity;
-import org.eclipse.om2m.commons.resource.AreaNwkInfo;
-import org.eclipse.om2m.commons.resource.ChildResourceRef;
-
-public class AreaNwkInfoMapper extends EntityMapper<AreaNwkInfoEntity, AreaNwkInfo> {
-
- @Override
- protected void mapAttributes(AreaNwkInfoEntity entity, AreaNwkInfo resource, int level, int offset) {
- if (level < 0) {
- return;
- }
-
- // Announceable resource attributes
- EntityMapperFactory.getAnnounceableSubordonateEntity_AnnounceableResourceMapper().mapAttributes(entity,
- resource, level, offset);
-
- resource.setAreaNwkType(entity.getAreaNwkType());
- resource.setCreationTime(entity.getCreationTime());
- resource.setDescription(entity.getDescription());
- resource.setExpirationTime(entity.getExpirationTime());
- resource.setLastModifiedTime(entity.getLastModifiedTime());
- resource.setMgmtDefinition(entity.getMgmtDefinition());
- resource.setName(entity.getName());
- resource.setParentID(entity.getParentID());
- resource.setResourceID(entity.getResourceID());
- resource.setResourceType(entity.getResourceType());
- if (!entity.getListOfDevices().isEmpty()) {
- resource.getListOfDevices().addAll(entity.getListOfDevices());
- }
- }
-
- @Override
- protected List<ChildResourceRef> getChildResourceRef(AreaNwkInfoEntity entity, int level, int offset) {
- return new ArrayList<>();
- }
-
- @Override
- protected void mapChildResourceRef(AreaNwkInfoEntity entity, AreaNwkInfo resource, int level, int offset) {
-
- }
-
- @Override
- protected void mapChildResources(AreaNwkInfoEntity entity, AreaNwkInfo resource, int level, int offset) {
-
- }
-
- @Override
- protected AreaNwkInfo createResource() {
- return new AreaNwkInfo();
- }
-
-}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/ContainerMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/ContainerMapper.java
index 7953e49..f25c59b 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/ContainerMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/ContainerMapper.java
@@ -26,15 +26,14 @@
import org.eclipse.om2m.commons.constants.ResourceType;
import org.eclipse.om2m.commons.constants.ResultContent;
import org.eclipse.om2m.commons.constants.ShortName;
-import org.eclipse.om2m.commons.entities.AccessControlPolicyEntity;
import org.eclipse.om2m.commons.entities.ContainerEntity;
import org.eclipse.om2m.commons.entities.ContentInstanceEntity;
import org.eclipse.om2m.commons.entities.FlexContainerEntity;
import org.eclipse.om2m.commons.entities.SubscriptionEntity;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
import org.eclipse.om2m.commons.resource.ChildResourceRef;
import org.eclipse.om2m.commons.resource.Container;
import org.eclipse.om2m.commons.resource.ContentInstance;
-import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
import org.eclipse.om2m.commons.resource.Subscription;
public class ContainerMapper extends EntityMapper<ContainerEntity, Container>{
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/CseBaseMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/CseBaseMapper.java
index 9e5933b..7d078c9 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/CseBaseMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/CseBaseMapper.java
@@ -38,12 +38,12 @@
import org.eclipse.om2m.commons.entities.RequestEntity;
import org.eclipse.om2m.commons.entities.SubscriptionEntity;
import org.eclipse.om2m.commons.resource.AE;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
import org.eclipse.om2m.commons.resource.AccessControlPolicy;
import org.eclipse.om2m.commons.resource.CSEBase;
import org.eclipse.om2m.commons.resource.ChildResourceRef;
import org.eclipse.om2m.commons.resource.Container;
import org.eclipse.om2m.commons.resource.DynamicAuthorizationConsultation;
-import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
import org.eclipse.om2m.commons.resource.Group;
import org.eclipse.om2m.commons.resource.RemoteCSE;
import org.eclipse.om2m.commons.resource.Request;
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/EntityMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/EntityMapper.java
index 2b290fd..c4f63b3 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/EntityMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/EntityMapper.java
@@ -24,18 +24,9 @@
import org.eclipse.om2m.commons.constants.Operation;
import org.eclipse.om2m.commons.constants.ResultContent;
-import org.eclipse.om2m.commons.entities.AccessControlPolicyEntity;
-import org.eclipse.om2m.commons.entities.AnnounceableSubordinateEntity;
-import org.eclipse.om2m.commons.entities.AnnouncedResourceEntity;
-import org.eclipse.om2m.commons.entities.DynamicAuthorizationConsultationEntity;
import org.eclipse.om2m.commons.entities.LabelEntity;
-import org.eclipse.om2m.commons.entities.RegularResourceEntity;
import org.eclipse.om2m.commons.entities.ResourceEntity;
-import org.eclipse.om2m.commons.resource.AnnounceableResource;
-import org.eclipse.om2m.commons.resource.AnnounceableSubordinateResource;
-import org.eclipse.om2m.commons.resource.AnnouncedResource;
import org.eclipse.om2m.commons.resource.ChildResourceRef;
-import org.eclipse.om2m.commons.resource.RegularResource;
import org.eclipse.om2m.commons.resource.RequestPrimitive;
import org.eclipse.om2m.commons.resource.Resource;
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/EntityMapperFactory.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/EntityMapperFactory.java
index 5467ed0..d5dccbf 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/EntityMapperFactory.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/EntityMapperFactory.java
@@ -25,8 +25,6 @@
import org.eclipse.om2m.commons.entities.AeEntity;
import org.eclipse.om2m.commons.entities.AnnounceableSubordinateEntity;
import org.eclipse.om2m.commons.entities.AnnouncedResourceEntity;
-import org.eclipse.om2m.commons.entities.AreaNwkDeviceInfoEntity;
-import org.eclipse.om2m.commons.entities.AreaNwkInfoEntity;
import org.eclipse.om2m.commons.entities.CSEBaseEntity;
import org.eclipse.om2m.commons.entities.ContainerEntity;
import org.eclipse.om2m.commons.entities.ContentInstanceEntity;
@@ -34,6 +32,7 @@
import org.eclipse.om2m.commons.entities.FlexContainerAnncEntity;
import org.eclipse.om2m.commons.entities.FlexContainerEntity;
import org.eclipse.om2m.commons.entities.GroupEntity;
+import org.eclipse.om2m.commons.entities.MgmtObjAnncEntity;
import org.eclipse.om2m.commons.entities.MgmtObjEntity;
import org.eclipse.om2m.commons.entities.NodeEntity;
import org.eclipse.om2m.commons.entities.PollingChannelEntity;
@@ -43,19 +42,19 @@
import org.eclipse.om2m.commons.entities.SubscriptionEntity;
import org.eclipse.om2m.commons.resource.AE;
import org.eclipse.om2m.commons.resource.AEAnnc;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
import org.eclipse.om2m.commons.resource.AccessControlPolicy;
import org.eclipse.om2m.commons.resource.AnnounceableResource;
import org.eclipse.om2m.commons.resource.AnnounceableSubordinateResource;
+import org.eclipse.om2m.commons.resource.AnnouncedMgmtResource;
import org.eclipse.om2m.commons.resource.AnnouncedResource;
-import org.eclipse.om2m.commons.resource.AreaNwkDeviceInfo;
-import org.eclipse.om2m.commons.resource.AreaNwkInfo;
import org.eclipse.om2m.commons.resource.CSEBase;
import org.eclipse.om2m.commons.resource.Container;
import org.eclipse.om2m.commons.resource.ContentInstance;
import org.eclipse.om2m.commons.resource.DynamicAuthorizationConsultation;
-import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
-import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
import org.eclipse.om2m.commons.resource.Group;
+import org.eclipse.om2m.commons.resource.MgmtObj;
import org.eclipse.om2m.commons.resource.Node;
import org.eclipse.om2m.commons.resource.PollingChannel;
import org.eclipse.om2m.commons.resource.RegularResource;
@@ -73,10 +72,12 @@
public static EntityMapper<CSEBaseEntity, CSEBase> getCseBaseMapper() {
return new CseBaseMapper();
}
+
/** Get the AE mapper */
public static EntityMapper<AeEntity, AE> getAEMapper(){
return new AeMapper();
}
+
public static EntityMapper<AeAnncEntity, AEAnnc> getAEAnncMapper() {
return new AeAnncMapper();
}
@@ -85,6 +86,7 @@
public static EntityMapper<AccessControlPolicyEntity,AccessControlPolicy> getAcpMapper(){
return new AcpMapper();
}
+
/** Get the Container mapper */
public static EntityMapper<ContainerEntity, Container> getContainerMapper(){
return new ContainerMapper();
@@ -99,6 +101,7 @@
public static EntityMapper<FlexContainerEntity, AbstractFlexContainer> getFlexContainerMapper(){
return new FlexContainerMapper();
}
+
/** Get the FlexContainerAnnc mapper */
public static EntityMapper<FlexContainerAnncEntity, AbstractFlexContainerAnnc> getFlexContainerAnncMapper(){
return new FlexContainerAnncMapper();
@@ -108,14 +111,17 @@
public static EntityMapper<ContentInstanceEntity, ContentInstance> getContentInstanceMapper(){
return new ContentInstanceMapper();
}
+
/** Get the group mapper */
public static EntityMapper<GroupEntity, Group> getGroupMapper(){
return new GroupMapper();
}
+
/** Get the node mapper */
public static EntityMapper<NodeEntity, Node> getNodeMapper() {
return new NodeMapper();
}
+
/** Get the Remote CSE mapper */
public static EntityMapper<RemoteCSEEntity, RemoteCSE> getRemoteCseMapper(){
return new RemoteCSEMapper();
@@ -124,6 +130,7 @@
public static EntityMapper<SubscriptionEntity, Subscription> getSubscriptionMapper(){
return new SubscriptionMapper();
}
+
/** Get the Polling channel mapper */
public static EntityMapper<PollingChannelEntity, PollingChannel> getPollingChannelMapper() {
return new PollingChannelMapper();
@@ -134,16 +141,16 @@
return new RequestMapper();
}
- /** Get the Area Nwk info mapper */
- public static EntityMapper<AreaNwkInfoEntity, AreaNwkInfo> getAreaNwkInfoMapper(){
- return new AreaNwkInfoMapper();
+ /** Get the MgmtObj mapper */
+ public static EntityMapper<MgmtObjEntity, MgmtObj> getMapperForMgmtObj() {
+ return new MgmtObjMapper();
}
- /** Get the Area Nwk device info mapper */
- public static EntityMapper<AreaNwkDeviceInfoEntity, AreaNwkDeviceInfo> getAreaNwkDeviceInfoMapper(){
- return new AreaNwkDeviceInfoMapper();
+ /** Get the MgmtObjAnnc mapper */
+ public static EntityMapper<MgmtObjAnncEntity, AnnouncedMgmtResource> getMapperForMgmtObjAnnc() {
+ return new MgmtObjAnncMapper();
}
-
+
/** Get the AnnounceableSubordinate mapper */
public static EntityMapper<AnnounceableSubordinateEntity, AnnounceableSubordinateResource> getAnnounceableSubordinateMapper() {
return new AnnounceableSubordinateMapper();
@@ -201,26 +208,12 @@
case ResourceType.REQUEST:
return new RequestMapper();
case ResourceType.MGMT_OBJ:
- throw new IllegalArgumentException("Cannot get Mapper for MGMT OBJ");
+ return new MgmtObjMapper();
+ case ResourceType.MGMT_OBJ_ANNC:
+ return new MgmtObjAnncMapper();
default:
return null;
}
}
- /**
- * Get the entity mapper for specific mgmtObj entity
- * @param mgmtObj
- * @return entity mapper
- */
- @SuppressWarnings("rawtypes")
- public static EntityMapper getMapperForMgmtObj(MgmtObjEntity mgmtObj) {
- if (mgmtObj instanceof AreaNwkInfoEntity) {
- return new AreaNwkInfoMapper();
- }
- if (mgmtObj instanceof AreaNwkDeviceInfoEntity) {
- return new AreaNwkDeviceInfoMapper();
- }
- return null;
- }
-
}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/FlexContainerAnncMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/FlexContainerAnncMapper.java
index 90f001b..5271ec7 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/FlexContainerAnncMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/FlexContainerAnncMapper.java
@@ -12,11 +12,10 @@
import org.eclipse.om2m.commons.constants.ResourceType;
import org.eclipse.om2m.commons.constants.ResultContent;
-import org.eclipse.om2m.commons.entities.AccessControlPolicyEntity;
import org.eclipse.om2m.commons.entities.FlexContainerAnncEntity;
import org.eclipse.om2m.commons.entities.SubscriptionEntity;
-import org.eclipse.om2m.commons.resource.ChildResourceRef;
import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.ChildResourceRef;
import org.eclipse.om2m.commons.resource.Subscription;
import org.eclipse.om2m.commons.resource.flexcontainerspec.FlexContainerFactory;
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/FlexContainerMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/FlexContainerMapper.java
index 25766e0..371354d 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/FlexContainerMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/FlexContainerMapper.java
@@ -17,11 +17,11 @@
import org.eclipse.om2m.commons.entities.CustomAttributeEntity;
import org.eclipse.om2m.commons.entities.FlexContainerEntity;
import org.eclipse.om2m.commons.entities.SubscriptionEntity;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
import org.eclipse.om2m.commons.resource.ChildResourceRef;
import org.eclipse.om2m.commons.resource.Container;
import org.eclipse.om2m.commons.resource.CustomAttribute;
import org.eclipse.om2m.commons.resource.FlexContainer;
-import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
import org.eclipse.om2m.commons.resource.Subscription;
import org.eclipse.om2m.commons.resource.flexcontainerspec.FlexContainerFactory;
import org.eclipse.om2m.core.flexcontainer.FlexContainerSelector;
@@ -41,7 +41,6 @@
@Override
protected void mapAttributes(FlexContainerEntity entity, AbstractFlexContainer resource, int level, int offset) {
-
if (level < 0) {
return;
}
@@ -54,6 +53,7 @@
resource.setOntologyRef(entity.getOntologyRef());
resource.setStateTag(entity.getStateTag());
resource.setContainerDefinition(entity.getContainerDefinition());
+ resource.setNodeLink(entity.getNodeLink());
resource.setLongName(entity.getLongName());
resource.setShortName(entity.getShortName());
@@ -85,7 +85,6 @@
@Override
protected List<ChildResourceRef> getChildResourceRef(FlexContainerEntity entity, int level, int offset) {
List<ChildResourceRef> childRefs = new ArrayList<>();
-
if (level == 0) {
return childRefs;
}
@@ -111,7 +110,6 @@
childRefs.addAll(new SubscriptionMapper().getChildResourceRef(sub, level - 1, offset - 1));
}
-
// add child ref with containers
for (ContainerEntity childCont : entity.getChildContainers()) {
ChildResourceRef child = new ChildResourceRef();
@@ -133,7 +131,6 @@
@Override
protected void mapChildResources(FlexContainerEntity entity, AbstractFlexContainer resource, int level, int offset) {
-
if (level == 0) {
return;
}
@@ -149,7 +146,6 @@
resource.getFlexContainerOrContainerOrSubscription().add(subRes);
}
-
// add child ref with containers
for (ContainerEntity childCont : entity.getChildContainers()) {
Container cnt = new ContainerMapper().mapEntityToResource(childCont, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
@@ -159,5 +155,4 @@
resource.finalizeSerialization();
}
-
}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/GroupMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/GroupMapper.java
index 9bc66a2..a3dd25f 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/GroupMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/GroupMapper.java
@@ -25,7 +25,6 @@
import org.eclipse.om2m.commons.constants.ResultContent;
import org.eclipse.om2m.commons.constants.ShortName;
-import org.eclipse.om2m.commons.entities.AccessControlPolicyEntity;
import org.eclipse.om2m.commons.entities.GroupEntity;
import org.eclipse.om2m.commons.entities.SubscriptionEntity;
import org.eclipse.om2m.commons.resource.ChildResourceRef;
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/MgmtObjAnncMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/MgmtObjAnncMapper.java
new file mode 100644
index 0000000..9c04c07
--- /dev/null
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/MgmtObjAnncMapper.java
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2013-2016 LAAS-CNRS (www.laas.fr)
+ * 7 Colonel Roche 31077 Toulouse - France
+ *
+ * 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
+ *
+ * Initial Contributors:
+ * Thierry Monteil : Project manager, technical co-manager
+ * Mahdi Ben Alaya : Technical co-manager
+ * Samir Medjiah : Technical co-manager
+ * Khalil Drira : Strategy expert
+ * Guillaume Garzone : Developer
+ * François Aïssaoui : Developer
+ *
+ * New contributors :
+ *******************************************************************************/
+package org.eclipse.om2m.core.entitymapper;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.om2m.commons.constants.ResourceType;
+import org.eclipse.om2m.commons.constants.ResultContent;
+import org.eclipse.om2m.commons.entities.MgmtObjAnncEntity;
+import org.eclipse.om2m.commons.entities.SubscriptionEntity;
+import org.eclipse.om2m.commons.resource.AnnouncedMgmtResource;
+import org.eclipse.om2m.commons.resource.ChildResourceRef;
+import org.eclipse.om2m.commons.resource.Subscription;
+
+public class MgmtObjAnncMapper extends EntityMapper<MgmtObjAnncEntity, AnnouncedMgmtResource> {
+
+ @Override
+ protected void mapAttributes(MgmtObjAnncEntity entity, AnnouncedMgmtResource resource, int level, int offset) {
+ if (level < 0) {
+ return;
+ }
+
+ // Announceable resource attributes
+ EntityMapperFactory.getAnnouncedResourceMapper().mapAttributes(entity,
+ resource, level, offset);
+
+ resource.setCreationTime(entity.getCreationTime());
+ resource.setDescription(entity.getDescription());
+ resource.setExpirationTime(entity.getExpirationTime());
+ resource.setLastModifiedTime(entity.getLastModifiedTime());
+ resource.setName(entity.getName());
+ resource.setParentID(entity.getParentID());
+ resource.setResourceID(entity.getResourceID());
+ resource.setResourceType(entity.getResourceType());
+
+// if (entity instanceof AreaNwkInfoEntity) {
+// mapSpecificAttributes((AreaNwkInfoEntity)entity, (AreaNwkInfo)resource);
+// } else if (entity instanceof AreaNwkDeviceInfoEntity) {
+// mapSpecificAttributes((AreaNwkDeviceInfoEntity)entity, (AreaNwkDeviceInfo)resource);
+// } else if (entity instanceof DeviceInfoEntity) {
+// mapSpecificAttributes((DeviceInfoEntity)entity, (DeviceInfo)resource);
+// }
+ }
+
+// private void mapSpecificAttributes(AreaNwkInfoEntity entity, AreaNwkInfo resource) {
+// resource.setAreaNwkType(entity.getAreaNwkType());
+// if (!entity.getListOfDevices().isEmpty()) {
+// resource.getListOfDevices().addAll(entity.getListOfDevices());
+// }
+// }
+//
+// private void mapSpecificAttributes(AreaNwkDeviceInfoEntity entity, AreaNwkDeviceInfo resource) {
+// resource.setAreaNwkId(entity.getAreaNwkId());
+// resource.setDevID(entity.getDevID());
+// resource.setSleepDuration(entity.getSleepDuration());
+// resource.setSleepInterval(entity.getSleepInterval());
+// resource.setStatus(entity.getStatus());
+// }
+//
+// private void mapSpecificAttributes(DeviceInfoEntity entity, DeviceInfo resource) {
+// resource.setDeviceLabel(entity.getDeviceLabel());
+// resource.setModel(entity.getModel());
+// resource.setManufacturer(entity.getManufacturer());
+// resource.setDeviceType(entity.getDeviceType());
+//
+// resource.setDeviceName(entity.getDeviceName());
+// resource.setFwVersion(entity.getFwVersion());
+// resource.setSwVersion(entity.getSwVersion());
+// resource.setHwVersion(entity.getHwVersion());
+// resource.setOsVersion(entity.getOsVersion());
+// resource.setManufacturerDetailsLink(entity.getManufacturerDetailsLink());
+// resource.setManufacturingDate(entity.getManufacturingDate());
+// resource.setSubModel(entity.getSubModel());
+// resource.setCountry(entity.getCountry());
+// resource.setLocation(entity.getLocation());
+// resource.setSystemTime(entity.getSystemTime());
+// resource.setSupportURL(entity.getSupportURL());
+// resource.setPresentationURL(entity.getPresentationURL());
+// resource.setProtocol(entity.getProtocol());
+// }
+
+ @Override
+ protected List<ChildResourceRef> getChildResourceRef(MgmtObjAnncEntity entity, int level, int offset) {
+ List<ChildResourceRef> childRefs = new ArrayList<>();
+ if (level == 0) {
+ return childRefs;
+ }
+ // add child ref subscription
+ for (SubscriptionEntity sub : entity.getSubscriptions()){
+ ChildResourceRef child = new ChildResourceRef();
+ child.setResourceName(sub.getName());
+ child.setType(ResourceType.SUBSCRIPTION);
+ child.setValue(sub.getResourceID());
+ childRefs.add(child);
+ childRefs.addAll(new SubscriptionMapper().getChildResourceRef(sub, level - 1, offset - 1));
+ }
+ return childRefs;
+ }
+
+ @Override
+ protected void mapChildResourceRef(MgmtObjAnncEntity entity, AnnouncedMgmtResource resource, int level, int offset) {
+// ((MgmtObjWithChildren)resource).getChildResource().addAll(getChildResourceRef(entity, level, offset));
+ }
+
+ @Override
+ protected void mapChildResources(MgmtObjAnncEntity entity, AnnouncedMgmtResource resource, int level, int offset) {
+ // add child ref subscription
+ for (SubscriptionEntity sub : entity.getSubscriptions()){
+ Subscription subRes = new SubscriptionMapper().mapEntityToResource(sub, ResultContent.ATTRIBUTES, level - 1, offset - 1);
+// ((MgmtObjWithChildren)resource).getSubscriptions().add(subRes);
+ }
+ }
+
+ @Override
+ protected AnnouncedMgmtResource createResource(MgmtObjAnncEntity entity) {
+// if (entity instanceof AreaNwkInfoEntity)
+// return new AreaNwkInfo();
+// if (entity instanceof AreaNwkDeviceInfoEntity)
+// return new AreaNwkDeviceInfo();
+// if (entity instanceof DeviceInfoEntity)
+// return new DeviceInfo();
+ return null;
+ }
+
+ protected AnnouncedMgmtResource createResource() {
+ return null;
+ }
+
+}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/MgmtObjMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/MgmtObjMapper.java
new file mode 100644
index 0000000..481f66e
--- /dev/null
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/MgmtObjMapper.java
@@ -0,0 +1,154 @@
+/*******************************************************************************
+ * Copyright (c) 2013-2016 LAAS-CNRS (www.laas.fr)
+ * 7 Colonel Roche 31077 Toulouse - France
+ *
+ * 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
+ *
+ * Initial Contributors:
+ * Thierry Monteil : Project manager, technical co-manager
+ * Mahdi Ben Alaya : Technical co-manager
+ * Samir Medjiah : Technical co-manager
+ * Khalil Drira : Strategy expert
+ * Guillaume Garzone : Developer
+ * François Aïssaoui : Developer
+ *
+ * New contributors :
+ *******************************************************************************/
+package org.eclipse.om2m.core.entitymapper;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.om2m.commons.constants.ResourceType;
+import org.eclipse.om2m.commons.constants.ResultContent;
+import org.eclipse.om2m.commons.entities.AreaNwkDeviceInfoEntity;
+import org.eclipse.om2m.commons.entities.AreaNwkInfoEntity;
+import org.eclipse.om2m.commons.entities.DeviceInfoEntity;
+import org.eclipse.om2m.commons.entities.MgmtObjEntity;
+import org.eclipse.om2m.commons.entities.SubscriptionEntity;
+import org.eclipse.om2m.commons.resource.AreaNwkDeviceInfo;
+import org.eclipse.om2m.commons.resource.AreaNwkInfo;
+import org.eclipse.om2m.commons.resource.ChildResourceRef;
+import org.eclipse.om2m.commons.resource.DeviceInfo;
+import org.eclipse.om2m.commons.resource.MgmtObj;
+import org.eclipse.om2m.commons.resource.MgmtObjWithChildren;
+import org.eclipse.om2m.commons.resource.Subscription;
+
+public class MgmtObjMapper extends EntityMapper<MgmtObjEntity, MgmtObj> {
+
+ @Override
+ protected void mapAttributes(MgmtObjEntity entity, MgmtObj resource, int level, int offset) {
+ if (level < 0) {
+ return;
+ }
+
+ // Announceable resource attributes
+ EntityMapperFactory.getAnnounceableSubordonateEntity_AnnounceableResourceMapper().mapAttributes(entity,
+ resource, level, offset);
+
+ resource.setCreationTime(entity.getCreationTime());
+ resource.setDescription(entity.getDescription());
+ resource.setExpirationTime(entity.getExpirationTime());
+ resource.setLastModifiedTime(entity.getLastModifiedTime());
+ resource.setName(entity.getName());
+ resource.setParentID(entity.getParentID());
+ resource.setResourceID(entity.getResourceID());
+ resource.setResourceType(entity.getResourceType());
+
+ if (entity instanceof AreaNwkInfoEntity) {
+ mapSpecificAttributes((AreaNwkInfoEntity)entity, (AreaNwkInfo)resource);
+ } else if (entity instanceof AreaNwkDeviceInfoEntity) {
+ mapSpecificAttributes((AreaNwkDeviceInfoEntity)entity, (AreaNwkDeviceInfo)resource);
+ } else if (entity instanceof DeviceInfoEntity) {
+ mapSpecificAttributes((DeviceInfoEntity)entity, (DeviceInfo)resource);
+ }
+ }
+
+ private void mapSpecificAttributes(AreaNwkInfoEntity entity, AreaNwkInfo resource) {
+ resource.setAreaNwkType(entity.getAreaNwkType());
+ if (!entity.getListOfDevices().isEmpty()) {
+ resource.getListOfDevices().addAll(entity.getListOfDevices());
+ }
+ }
+
+ private void mapSpecificAttributes(AreaNwkDeviceInfoEntity entity, AreaNwkDeviceInfo resource) {
+ resource.setAreaNwkId(entity.getAreaNwkId());
+ resource.setDevID(entity.getDevID());
+ resource.setSleepDuration(entity.getSleepDuration());
+ resource.setSleepInterval(entity.getSleepInterval());
+ resource.setStatus(entity.getStatus());
+ }
+
+ private void mapSpecificAttributes(DeviceInfoEntity entity, DeviceInfo resource) {
+ resource.setDeviceLabel(entity.getDeviceLabel());
+ resource.setModel(entity.getModel());
+ resource.setManufacturer(entity.getManufacturer());
+ resource.setDeviceType(entity.getDeviceType());
+
+ resource.setDeviceName(entity.getDeviceName());
+ resource.setFwVersion(entity.getFwVersion());
+ resource.setSwVersion(entity.getSwVersion());
+ resource.setHwVersion(entity.getHwVersion());
+ resource.setOsVersion(entity.getOsVersion());
+ resource.setManufacturerDetailsLink(entity.getManufacturerDetailsLink());
+ resource.setManufacturingDate(entity.getManufacturingDate());
+ resource.setSubModel(entity.getSubModel());
+ resource.setCountry(entity.getCountry());
+ resource.setLocation(entity.getLocation());
+ resource.setSystemTime(entity.getSystemTime());
+ resource.setSupportURL(entity.getSupportURL());
+ resource.setPresentationURL(entity.getPresentationURL());
+ resource.setProtocol(entity.getProtocol());
+ }
+
+ @Override
+ protected List<ChildResourceRef> getChildResourceRef(MgmtObjEntity entity, int level, int offset) {
+ List<ChildResourceRef> childRefs = new ArrayList<>();
+ if (level == 0) {
+ return childRefs;
+ }
+ // add child ref subscription
+ for (SubscriptionEntity sub : entity.getSubscriptions()){
+ ChildResourceRef child = new ChildResourceRef();
+ child.setResourceName(sub.getName());
+ child.setType(ResourceType.SUBSCRIPTION);
+ child.setValue(sub.getResourceID());
+ childRefs.add(child);
+ childRefs.addAll(new SubscriptionMapper().getChildResourceRef(sub, level - 1, offset - 1));
+ }
+ return childRefs;
+ }
+
+ @Override
+ protected void mapChildResourceRef(MgmtObjEntity entity, MgmtObj resource, int level, int offset) {
+ ((MgmtObjWithChildren)resource).getChildResource().addAll(getChildResourceRef(entity, level, offset));
+ }
+
+ @Override
+ protected void mapChildResources(MgmtObjEntity entity, MgmtObj resource, int level, int offset) {
+ // add child ref subscription
+ for (SubscriptionEntity sub : entity.getSubscriptions()){
+ Subscription subRes = new SubscriptionMapper().mapEntityToResource(sub, ResultContent.ATTRIBUTES, level - 1, offset - 1);
+ ((MgmtObjWithChildren)resource).getSubscriptions().add(subRes);
+ }
+ }
+
+ @Override
+ protected MgmtObj createResource(MgmtObjEntity entity) {
+ if (entity instanceof AreaNwkInfoEntity)
+ return new AreaNwkInfo();
+ if (entity instanceof AreaNwkDeviceInfoEntity)
+ return new AreaNwkDeviceInfo();
+ if (entity instanceof DeviceInfoEntity)
+ return new DeviceInfo();
+ return null;
+ }
+
+ protected MgmtObj createResource() {
+ return null;
+ }
+
+}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/NodeMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/NodeMapper.java
index 618eaf0..3c035ff 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/NodeMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/NodeMapper.java
@@ -24,13 +24,12 @@
import org.eclipse.om2m.commons.constants.ResourceType;
import org.eclipse.om2m.commons.constants.ResultContent;
-import org.eclipse.om2m.commons.entities.AreaNwkDeviceInfoEntity;
-import org.eclipse.om2m.commons.entities.AreaNwkInfoEntity;
+import org.eclipse.om2m.commons.entities.MgmtObjEntity;
import org.eclipse.om2m.commons.entities.NodeEntity;
-import org.eclipse.om2m.commons.resource.AreaNwkDeviceInfo;
-import org.eclipse.om2m.commons.resource.AreaNwkInfo;
+import org.eclipse.om2m.commons.entities.SubscriptionEntity;
import org.eclipse.om2m.commons.resource.ChildResourceRef;
import org.eclipse.om2m.commons.resource.Node;
+import org.eclipse.om2m.commons.resource.Subscription;
/**
* Mapper for Node resource - entity
@@ -38,46 +37,51 @@
*/
public class NodeMapper extends EntityMapper<NodeEntity, Node> {
+ private MgmtObjMapper mgmtObjMapper;
+
+ public NodeMapper() {
+ super();
+ mgmtObjMapper = new MgmtObjMapper();
+ }
+
@Override
protected void mapAttributes(NodeEntity entity, Node resource, int level, int offset) {
-
if (level < 0) {
return;
}
// announceableResource attributes
- EntityMapperFactory.getAnnounceableSubordonateEntity_AnnounceableResourceMapper().mapAttributes(entity, resource, level, offset);
+ EntityMapperFactory.getAnnounceableSubordonateEntity_AnnounceableResourceMapper()
+ .mapAttributes(entity, resource, level, offset);
// node attribute
resource.setNodeID(entity.getNodeID());
resource.setHostedCSELink(entity.getHostedCSELink());
+ resource.setHostedAppLinks(entity.getHostedAppLink());
}
@Override
- protected List<ChildResourceRef> getChildResourceRef(NodeEntity entity, int level, int offset) {
+ protected List<ChildResourceRef> getChildResourceRef(NodeEntity entity,
+ int level, int offset) {
List<ChildResourceRef> childRefs = new ArrayList<>();
-
if (level == 0) {
return childRefs;
}
-
- // add child area nwk info entities
- for (AreaNwkInfoEntity aniEntity : entity.getChildAreaNwkInfoEntities()) {
- ChildResourceRef chref = new ChildResourceRef();
- chref.setResourceName(aniEntity.getName());
- chref.setType(ResourceType.MGMT_OBJ);
- chref.setValue(aniEntity.getResourceID());
- childRefs.add(chref);
- childRefs.addAll(new AreaNwkInfoMapper().getChildResourceRef(aniEntity, level - 1, offset - 1));
+
+ // add child ref subscription
+ for (SubscriptionEntity sub : entity.getSubscriptions()){
+ ChildResourceRef child = new ChildResourceRef();
+ child.setResourceName(sub.getName());
+ child.setType(ResourceType.SUBSCRIPTION);
+ child.setValue(sub.getResourceID());
+ childRefs.add(child);
+ childRefs.addAll(new SubscriptionMapper().getChildResourceRef(sub, level - 1, offset - 1));
}
- // add child area nwk device info entities
- for (AreaNwkDeviceInfoEntity andiEntity : entity.getChildAreaNwkDeviceInfoEntities()) {
- ChildResourceRef chref = new ChildResourceRef();
- chref.setResourceName(andiEntity.getName());
- chref.setType(ResourceType.MGMT_OBJ);
- chref.setValue(andiEntity.getResourceID());
- childRefs.add(chref);
- childRefs.addAll(new AreaNwkDeviceInfoMapper().getChildResourceRef(andiEntity, level - 1, offset - 1));
+
+ // add mgmt obj entities
+ for (MgmtObjEntity mgmtObj : entity.getMgmtObjEntities()) {
+ childRefs.add(createChildResourceRef(mgmtObj));
+ childRefs.addAll(mgmtObjMapper.getChildResourceRef(mgmtObj, level - 1, offset - 1));
}
return childRefs;
@@ -90,15 +94,15 @@
@Override
protected void mapChildResources(NodeEntity entity, Node resource, int level, int offset) {
- // add child area nwk info entities
- for (AreaNwkInfoEntity aniEntity : entity.getChildAreaNwkInfoEntities()) {
- AreaNwkInfo aniRes = new AreaNwkInfoMapper().mapEntityToResource(aniEntity, ResultContent.ATTRIBUTES, level - 1, offset - 1);
- resource.getMemoryOrBatteryOrAreaNwkInfo().add(aniRes);
+ // add child ref subscription
+ for (SubscriptionEntity sub : entity.getSubscriptions()){
+ Subscription subRes = new SubscriptionMapper().mapEntityToResource(sub, ResultContent.ATTRIBUTES, level - 1, offset - 1);
+ resource.getSubscriptions().add(subRes);
}
- // add child area nwk device info entities
- for (AreaNwkDeviceInfoEntity andiEntity : entity.getChildAreaNwkDeviceInfoEntities()) {
- AreaNwkDeviceInfo andiRes = new AreaNwkDeviceInfoMapper().mapEntityToResource(andiEntity, ResultContent.ATTRIBUTES, level - 1, offset - 1);
- resource.getMemoryOrBatteryOrAreaNwkInfo().add(andiRes);
+ // add mgmt obj entities
+ for (MgmtObjEntity mgmtObj : entity.getMgmtObjEntities()) {
+ resource.getMgmtObjs().add(mgmtObjMapper.mapEntityToResource(mgmtObj,
+ ResultContent.ATTRIBUTES, level - 1, offset - 1));
}
}
@@ -107,4 +111,12 @@
return new Node();
}
+ private final ChildResourceRef createChildResourceRef(MgmtObjEntity entity) {
+ ChildResourceRef chref = new ChildResourceRef();
+ chref.setResourceName(entity.getName());
+ chref.setType(ResourceType.MGMT_OBJ);
+ chref.setValue(entity.getResourceID());
+ return chref;
+ }
+
}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/RemoteCSEMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/RemoteCSEMapper.java
index a761c27..898c314 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/RemoteCSEMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/RemoteCSEMapper.java
@@ -37,11 +37,11 @@
import org.eclipse.om2m.commons.entities.SubscriptionEntity;
import org.eclipse.om2m.commons.resource.AE;
import org.eclipse.om2m.commons.resource.AEAnnc;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
import org.eclipse.om2m.commons.resource.AccessControlPolicy;
import org.eclipse.om2m.commons.resource.ChildResourceRef;
import org.eclipse.om2m.commons.resource.Container;
import org.eclipse.om2m.commons.resource.DynamicAuthorizationConsultation;
-import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
import org.eclipse.om2m.commons.resource.Group;
import org.eclipse.om2m.commons.resource.PollingChannel;
import org.eclipse.om2m.commons.resource.RemoteCSE;
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/RequestMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/RequestMapper.java
index 7e7a679..e8f35a0 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/RequestMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/RequestMapper.java
@@ -25,8 +25,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.eclipse.om2m.commons.constants.MimeMediaType;
-import org.eclipse.om2m.commons.entities.AccessControlPolicyEntity;
-import org.eclipse.om2m.commons.entities.DynamicAuthorizationConsultationEntity;
import org.eclipse.om2m.commons.entities.RequestEntity;
import org.eclipse.om2m.commons.resource.ChildResourceRef;
import org.eclipse.om2m.commons.resource.MetaInformation;
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/flexcontainer/FlexContainerSelector.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/flexcontainer/FlexContainerSelector.java
index 901cccb..172844f 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/flexcontainer/FlexContainerSelector.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/flexcontainer/FlexContainerSelector.java
@@ -9,8 +9,6 @@
import java.util.HashMap;
import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/notifier/Notifier.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/notifier/Notifier.java
index 41b71f3..ffc9556 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/notifier/Notifier.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/notifier/Notifier.java
@@ -38,7 +38,6 @@
import org.eclipse.om2m.commons.entities.CSEBaseEntity;
import org.eclipse.om2m.commons.entities.ContainerEntity;
import org.eclipse.om2m.commons.entities.GroupEntity;
-import org.eclipse.om2m.commons.entities.MgmtObjEntity;
import org.eclipse.om2m.commons.entities.RemoteCSEEntity;
import org.eclipse.om2m.commons.entities.ResourceEntity;
import org.eclipse.om2m.commons.entities.ScheduleEntity;
@@ -267,15 +266,9 @@
// Get the representation of the content
Resource serializableResource;
- EntityMapper mapper ;
- if (sub.getNotificationContentType() != null){
- if (resource.getResourceType().equals(ResourceType.MGMT_OBJ)) {
- mapper = EntityMapperFactory.getMapperForMgmtObj((MgmtObjEntity) resource);
- } else {
- mapper = EntityMapperFactory.
- getMapperFromResourceType(resource.getResourceType().intValue());
- }
- if(sub.getNotificationContentType().equals(NotificationContentType.MODIFIED_ATTRIBUTES)){
+ if (sub.getNotificationContentType() != null) {
+ EntityMapper mapper = EntityMapperFactory.getMapperFromResourceType(resource.getResourceType().intValue());
+ if (sub.getNotificationContentType().equals(NotificationContentType.MODIFIED_ATTRIBUTES)) {
Representation representation = new Representation();
if (modifiedOnlyResource != null) {
// Gregory BONNARDEL - 26 Avril 2016
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/router/Patterns.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/router/Patterns.java
index d2fe46f..0b7c185 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/router/Patterns.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/router/Patterns.java
@@ -35,21 +35,24 @@
public class Patterns implements Constants {
/** All short name for filtering */
- public final String ALL_SHORT_NAMES = ShortName.ACP+"|"+ShortName.AE+"|"+ShortName.CNT+
- "|"+ShortName.CIN + "|" + ShortName.REMOTE_CSE + "|" + ShortName.LATEST + "|" + ShortName.OLDEST +
+ private static final String ALL_SHORT_NAMES = ShortName.ACP + "|" + ShortName.AE + "|" + ShortName.CNT +
+ "|" + ShortName.CIN + "|" + ShortName.REMOTE_CSE + "|" + ShortName.LATEST + "|" + ShortName.OLDEST +
"|" + ShortName.GROUP + "|" + ShortName.FANOUTPOINT + "|" + ShortName.SUB + "|" + ShortName.PCH +
- "|" + ShortName.POLLING_CHANNEL_URI + "|" + ShortName.REQ + "|" + ShortName.NODE +
- "|" + ShortName.ANI + "|" + ShortName.ANDI + "|" + ShortName.FCNT + "|" + ShortName.DAC;
+ "|" + ShortName.POLLING_CHANNEL_URI + "|" + ShortName.REQ +
+ "|" + ShortName.NODE + "|" + ShortName.MGO +
+ "|" + ShortName.FCNT + "|" + ShortName.DAC;
- public final String NON_HIERARCHICAL_ID = "(" + Constants.PREFIX_SEPERATOR +"(\\b\\w+\\b)?)" ;
-
- public final Pattern UNAUTHORIZED_NAMES = Pattern.compile(ShortName.ACP + NON_HIERARCHICAL_ID + "?|" +
- ShortName.AE + NON_HIERARCHICAL_ID + "?|" + ShortName.CNT + NON_HIERARCHICAL_ID + "?|" +
- ShortName.CIN + NON_HIERARCHICAL_ID + "?|" + ShortName.REMOTE_CSE + NON_HIERARCHICAL_ID + "?|" +
- ShortName.LATEST + NON_HIERARCHICAL_ID + "?|" + ShortName.OLDEST + NON_HIERARCHICAL_ID + "?|" +
- ShortName.GROUP + NON_HIERARCHICAL_ID + "?|" + ShortName.FANOUTPOINT + NON_HIERARCHICAL_ID + "?|" +
- ShortName.SUB + NON_HIERARCHICAL_ID + "?|" + ShortName.PCH + "?|" + ShortName.POLLING_CHANNEL_URI +
- "?|" + ShortName.REQ + "?|" + ShortName.NODE + "?|" + ShortName.FCNT + "?|" + ShortName.DAC + "?");
+// private static final String NON_HIERARCHICAL_ID = "(" + Constants.PREFIX_SEPERATOR +"(\\b\\w+\\b)?)" ;
+//
+// private static final Pattern UNAUTHORIZED_NAMES = Pattern.compile(ShortName.ACP + NON_HIERARCHICAL_ID + "?|" +
+// ShortName.AE + NON_HIERARCHICAL_ID + "?|" + ShortName.CNT + NON_HIERARCHICAL_ID + "?|" +
+// ShortName.CIN + NON_HIERARCHICAL_ID + "?|" + ShortName.REMOTE_CSE + NON_HIERARCHICAL_ID + "?|" +
+// ShortName.LATEST + NON_HIERARCHICAL_ID + "?|" + ShortName.OLDEST + NON_HIERARCHICAL_ID + "?|" +
+// ShortName.GROUP + NON_HIERARCHICAL_ID + "?|" + ShortName.FANOUTPOINT + NON_HIERARCHICAL_ID + "?|" +
+// ShortName.SUB + NON_HIERARCHICAL_ID + "?|" + ShortName.PCH + "?|" +
+// ShortName.POLLING_CHANNEL_URI + "?|" + ShortName.REQ + "?|" +
+// ShortName.NODE + "?|" + ShortName.MGO + "?|" +
+// ShortName.FCNT + "?|" + ShortName.DAC + "?");
/** Main id string */
public final String ID_STRING = "([A-Za-z0-9_\\-~#]|\\.)+";
@@ -94,10 +97,8 @@
public final String FANOUT_POINT_MATCH = "/" + ShortName.FANOUTPOINT ;
public final Pattern NODE_PATTERN = Pattern.compile(CSE_BASE_PATTERN + "/" + ShortName.NODE + Constants.PREFIX_SEPERATOR + ID_STRING);
-
- public final Pattern AREA_NW_INFO_PATTERN = Pattern.compile(CSE_BASE_PATTERN + "/" + ShortName.ANI + Constants.PREFIX_SEPERATOR + ID_STRING);
-
- public final Pattern AREA_NWK_DEVICE_INFO_PATTERN = Pattern.compile(CSE_BASE_PATTERN + "/" + ShortName.ANDI + Constants.PREFIX_SEPERATOR + ID_STRING);
+
+ public final Pattern NMGMT_OBJ_PATTERN = Pattern.compile(CSE_BASE_PATTERN + "/" + ShortName.MGO + Constants.PREFIX_SEPERATOR + ID_STRING);
/** Non-hierarchical URI pattern */
public final Pattern NON_HIERARCHICAL_PATTERN = Pattern.compile(
@@ -174,7 +175,10 @@
return db.getDAOFactory().getRequestEntityDAO();
}
if (match(NODE_PATTERN, uri)) {
- return db.getDAOFactory().getNodeEntityDAO();
+ return db.getDAOFactory().getNodeDAO();
+ }
+ if (match(NMGMT_OBJ_PATTERN, uri)) {
+ return db.getDAOFactory().getMgmtObjDAO();
}
return null;
}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/router/Router.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/router/Router.java
index 72d6b09..4c84857 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/router/Router.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/router/Router.java
@@ -39,12 +39,11 @@
import org.eclipse.om2m.commons.exceptions.NotImplementedException;
import org.eclipse.om2m.commons.exceptions.Om2mException;
import org.eclipse.om2m.commons.exceptions.ResourceNotFoundException;
-import org.eclipse.om2m.commons.resource.DynamicAuthorizationConsultation;
import org.eclipse.om2m.commons.resource.RequestPrimitive;
import org.eclipse.om2m.commons.resource.ResponsePrimitive;
+import org.eclipse.om2m.core.controller.AEAnncController;
import org.eclipse.om2m.core.controller.AEController;
import org.eclipse.om2m.core.controller.AccessControlPolicyController;
-import org.eclipse.om2m.core.controller.AEAnncController;
import org.eclipse.om2m.core.controller.CSEBaseController;
import org.eclipse.om2m.core.controller.ContainerController;
import org.eclipse.om2m.core.controller.ContentInstanceController;
@@ -57,6 +56,8 @@
import org.eclipse.om2m.core.controller.GroupController;
import org.eclipse.om2m.core.controller.LatestOldestController;
import org.eclipse.om2m.core.controller.LatestOldestController.SortingPolicy;
+import org.eclipse.om2m.core.controller.MgmtObjAnncController;
+import org.eclipse.om2m.core.controller.MgmtObjController;
import org.eclipse.om2m.core.controller.NodeController;
import org.eclipse.om2m.core.controller.PollingChannelController;
import org.eclipse.om2m.core.controller.PollingChannelUriController;
@@ -309,6 +310,9 @@
if (patterns.match(patterns.NODE_PATTERN, uri)) {
return new NodeController();
}
+ if (patterns.match(patterns.NMGMT_OBJ_PATTERN, uri)) {
+ return new MgmtObjController();
+ }
if (patterns.match(patterns.SUBSCRIPTION_PATTERN, uri)){
return new SubscriptionController();
}
@@ -365,6 +369,10 @@
return new AEAnncController();
case ResourceType.FLEXCONTAINER_ANNC:
return new FlexContainerAnncController();
+ case ResourceType.MGMT_OBJ:
+ return new MgmtObjController();
+ case ResourceType.MGMT_OBJ_ANNC:
+ return new MgmtObjAnncController();
default :
throw new NotImplementedException("ResourceType: " + resourceType + " is not implemented");
}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/util/ControllerUtil.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/util/ControllerUtil.java
index e3d341f..20510dd 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/util/ControllerUtil.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/util/ControllerUtil.java
@@ -27,14 +27,12 @@
import org.eclipse.om2m.commons.entities.AccessControlPolicyEntity;
import org.eclipse.om2m.commons.entities.AnnounceableSubordinateEntity;
import org.eclipse.om2m.commons.entities.DynamicAuthorizationConsultationEntity;
-import org.eclipse.om2m.commons.entities.RegularResourceEntity;
import org.eclipse.om2m.commons.entities.ResourceEntity;
import org.eclipse.om2m.commons.exceptions.BadRequestException;
import org.eclipse.om2m.commons.exceptions.NotPermittedAttrException;
import org.eclipse.om2m.commons.exceptions.Om2mException;
import org.eclipse.om2m.commons.exceptions.ResourceNotFoundException;
import org.eclipse.om2m.commons.resource.AnnounceableResource;
-import org.eclipse.om2m.commons.resource.RegularResource;
import org.eclipse.om2m.commons.resource.Resource;
import org.eclipse.om2m.commons.utils.Util.DateUtil;
import org.eclipse.om2m.core.persistence.PersistenceService;
diff --git a/org.eclipse.om2m.ipe.sdt/META-INF/MANIFEST.MF b/org.eclipse.om2m.ipe.sdt/META-INF/MANIFEST.MF
index e814fc3..41c48a9 100644
--- a/org.eclipse.om2m.ipe.sdt/META-INF/MANIFEST.MF
+++ b/org.eclipse.om2m.ipe.sdt/META-INF/MANIFEST.MF
@@ -21,6 +21,7 @@
org.eclipse.om2m.sdt.events,
org.eclipse.om2m.sdt.exceptions,
org.eclipse.om2m.sdt.types,
+ org.eclipse.om2m.sdt.home.types,
org.osgi.framework,
org.osgi.service.cm,
org.osgi.service.component,
diff --git a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/Activator.java b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/Activator.java
index 9ec18ac..f8c2d83 100644
--- a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/Activator.java
+++ b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/Activator.java
@@ -44,7 +44,6 @@
private boolean isSDTIPEStarted = false;
private SDTIpeApplication sdtIPEApplication;
- private CseService cseService;
private static BundleContext bundleContext;
@@ -85,12 +84,12 @@
protected void setCseService(CseService cseService) {
logger.info("setCseService");
- this.cseService = cseService;
+ CseUtil.cseService = cseService;
}
protected void unsetCseService(CseService pCseService) {
logger.info("unsetCseService");
- this.cseService = null;
+ CseUtil.cseService = null;
}
protected void setDevice(Device device) {
@@ -122,7 +121,7 @@
// unregister a previous version
unregisterSdtIpeApplication();
}
- sdtIPEApplication = new SDTIpeApplication(cseService, announceCseId, cseName, ipeUnder, hasToBeAnnounced);
+ sdtIPEApplication = new SDTIpeApplication(announceCseId, cseName, ipeUnder, hasToBeAnnounced);
sdtIPEApplication.publishSDTIPEApplication();
DeviceList.getInstance().addListenerAndSend(sdtIPEApplication);
}
@@ -267,8 +266,7 @@
ResponsePrimitive response = null;
// check 3 times
for (int i = 0; i < 3; i++) {
- response = CseUtil.sendRetrieveRequest(cseService,
- "/" + remoteCseId + "/" + remoteCseName + "/" + Constants.CSE_NAME);
+ response = CseUtil.sendRetrieveRequest("/" + remoteCseId + "/" + remoteCseName + "/" + Constants.CSE_NAME);
if (ResponseStatusCode.OK.equals(response.getResponseStatusCode())) {
break;
}
diff --git a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/CseUtil.java b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/CseUtil.java
index 171875c..81b5c6c 100644
--- a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/CseUtil.java
+++ b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/CseUtil.java
@@ -9,17 +9,23 @@
import java.util.List;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.eclipse.om2m.commons.constants.AccessControl;
import org.eclipse.om2m.commons.constants.Constants;
import org.eclipse.om2m.commons.constants.MimeMediaType;
import org.eclipse.om2m.commons.constants.Operation;
import org.eclipse.om2m.commons.constants.ResourceType;
+import org.eclipse.om2m.commons.constants.ResponseStatusCode;
import org.eclipse.om2m.commons.resource.AE;
import org.eclipse.om2m.commons.resource.AEAnnc;
import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
import org.eclipse.om2m.commons.resource.AccessControlPolicy;
import org.eclipse.om2m.commons.resource.AccessControlRule;
+import org.eclipse.om2m.commons.resource.DeviceInfo;
+import org.eclipse.om2m.commons.resource.Node;
import org.eclipse.om2m.commons.resource.RequestPrimitive;
+import org.eclipse.om2m.commons.resource.Resource;
import org.eclipse.om2m.commons.resource.ResponsePrimitive;
import org.eclipse.om2m.commons.resource.SetOfAcrs;
import org.eclipse.om2m.commons.resource.Subscription;
@@ -27,6 +33,10 @@
public class CseUtil {
+ private static final Log logger = LogFactory.getLog(CseUtil.class);
+
+ static CseService cseService;
+
/**
* Send a oM2M CREATE Application Entity request
*
@@ -40,19 +50,17 @@
* name of the to be created application
* @return ResponsePrimitive sent by the CSE
*/
- public static ResponsePrimitive sendCreateApplicationEntityRequest(CseService cseService, AE ae,
+ public static ResponsePrimitive sendCreateApplicationEntityRequest(AE ae,
String resourceLocation) {
RequestPrimitive request = new RequestPrimitive();
-
request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);
request.setTo(resourceLocation);
request.setOperation(Operation.CREATE);
- request.setRequestContentType(MimeMediaType.OBJ);
request.setResourceType(ResourceType.AE);
+ request.setRequestContentType(MimeMediaType.OBJ);
request.setReturnContentType(MimeMediaType.OBJ);
request.setContent(ae);
-
- return sendRequest(cseService, request);
+ return cseService.doRequest(request);
}
/**
@@ -66,18 +74,16 @@
* location of the to be created application
* @return ResponsePrimitive sent by the CSE
*/
- public static ResponsePrimitive sendUpdateApplicationAnncEntityRequest(CseService cseService, AEAnnc aeAnnc,
+ public static ResponsePrimitive sendUpdateApplicationAnncEntityRequest(AEAnnc aeAnnc,
String resourceLocation) {
RequestPrimitive request = new RequestPrimitive();
-
request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);
request.setTo(resourceLocation);
request.setOperation(Operation.UPDATE);
request.setRequestContentType(MimeMediaType.OBJ);
request.setReturnContentType(MimeMediaType.OBJ);
request.setContent(aeAnnc);
-
- return sendRequest(cseService, request);
+ return cseService.doRequest(request);
}
/**
@@ -91,19 +97,17 @@
* location of the to be created application
* @return ResponsePrimitive sent by the CSE
*/
- public static ResponsePrimitive sendCreateSubscriptionRequest(CseService cseService, Subscription subscription,
+ public static ResponsePrimitive sendCreateSubscriptionRequest(Subscription subscription,
String resourceLocation) {
RequestPrimitive request = new RequestPrimitive();
-
request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);
request.setTo(resourceLocation);
request.setOperation(Operation.CREATE);
- request.setRequestContentType(MimeMediaType.OBJ);
request.setResourceType(ResourceType.SUBSCRIPTION);
+ request.setRequestContentType(MimeMediaType.OBJ);
request.setReturnContentType(MimeMediaType.OBJ);
request.setContent(subscription);
-
- return sendRequest(cseService, request);
+ return cseService.doRequest(request);
}
/**
@@ -114,23 +118,41 @@
* @param resourceLocation location of the to be created resource
* @return response sent by the CSE
*/
- public static ResponsePrimitive sendCreateFlexContainerRequest(CseService cseService, AbstractFlexContainer flexContainer,
+ public static ResponsePrimitive sendCreateFlexContainerRequest(AbstractFlexContainer flexContainer,
String resourceLocation) {
RequestPrimitive request = new RequestPrimitive();
-
request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);
request.setTo(resourceLocation);
request.setOperation(Operation.CREATE);
- request.setRequestContentType(MimeMediaType.OBJ);
request.setResourceType(ResourceType.FLEXCONTAINER);
+ request.setRequestContentType(MimeMediaType.OBJ);
request.setReturnContentType(MimeMediaType.OBJ);
request.setContent(flexContainer);
+ return cseService.doRequest(request);
+ }
- return sendRequest(cseService, request);
+ /**
+ * Send a UPDATE FlexContainer request
+ *
+ * @param cseService CSE service
+ * @param flexContainer flexContainer to be updated
+ * @param resourceLocation location of the to be created resource
+ * @return response sent by the CSE
+ */
+ public static ResponsePrimitive sendUpdateFlexContainerRequest(AbstractFlexContainer flexContainer) {
+ RequestPrimitive request = new RequestPrimitive();
+ request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);
+ request.setOperation(Operation.UPDATE);
+ request.setTo(flexContainer.getResourceID());
+ request.setResourceType(ResourceType.FLEXCONTAINER);
+ request.setRequestContentType(MimeMediaType.OBJ);
+ request.setReturnContentType(MimeMediaType.OBJ);
+ request.setContent(flexContainer);
+ return cseService.doRequest(request);
}
- public static ResponsePrimitive sendCreateDefaultACP(CseService cseService, String acpLocation, String acpName, List<String> labels) {
-
+ public static ResponsePrimitive sendCreateDefaultACP(String acpLocation,
+ String acpName, List<String> labels) {
AccessControlPolicy acp = new AccessControlPolicy();
acp.setName(acpName);
acp.getLabels().addAll(labels);
@@ -151,20 +173,53 @@
acp.getSelfPrivileges().getAccessControlRule().add(acrSP);
RequestPrimitive request = new RequestPrimitive();
-
request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);
request.setTo(acpLocation);
request.setOperation(Operation.CREATE);
- request.setRequestContentType(MimeMediaType.OBJ);
request.setResourceType(ResourceType.ACCESS_CONTROL_POLICY);
+ request.setRequestContentType(MimeMediaType.OBJ);
request.setReturnContentType(MimeMediaType.OBJ);
request.setContent(acp);
-
-
- return sendRequest(cseService, request);
+ return cseService.doRequest(request);
}
-
+
+ /**
+ * Send a CREATE Node request
+ *
+ * @param cseService CSE service
+ * @param node the node to be created
+ * @param devInfo the deviceInfo to be created (child of node)
+ * @param baseLocation location of the to be created resource
+ * @return response sent by the CSE
+ */
+ public static ResponsePrimitive sendCreateNodeRequest(Node node,
+ DeviceInfo devInfo, String baseLocation) {
+ RequestPrimitive request = new RequestPrimitive();
+ request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);
+ request.setTo(baseLocation);
+ request.setOperation(Operation.CREATE);
+ request.setResourceType(ResourceType.NODE);
+ request.setRequestContentType(MimeMediaType.OBJ);
+ request.setReturnContentType(MimeMediaType.OBJ);
+ request.setContent(node);
+
+ ResponsePrimitive resp = cseService.doRequest(request);
+ if (! resp.getResponseStatusCode().equals(ResponseStatusCode.CREATED))
+ return resp;
+ Node createdNode = (Node) resp.getContent();
+
+ request = new RequestPrimitive();
+ request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);
+ request.setTo(createdNode.getResourceID());
+ request.setOperation(Operation.CREATE);
+ request.setResourceType(ResourceType.MGMT_OBJ);
+ request.setRequestContentType(MimeMediaType.OBJ);
+ request.setReturnContentType(MimeMediaType.OBJ);
+ request.setContent(devInfo);
+ return cseService.doRequest(request);
+ }
+
/**
* Send a INTERNAL NOTIFY FlexContainer request
*
@@ -174,10 +229,9 @@
*
* @return response sent by the CSE
*/
- public static ResponsePrimitive sendInternalNotifyFlexContainerRequest(CseService cseService, AbstractFlexContainer flexContainer,
+ public static ResponsePrimitive sendInternalNotifyFlexContainerRequest(AbstractFlexContainer flexContainer,
String resourceLocation) {
RequestPrimitive request = new RequestPrimitive();
-
request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);
request.setTo(resourceLocation);
request.setOperation(Operation.INTERNAL_NOTIFY);
@@ -185,27 +239,23 @@
request.setResourceType(ResourceType.FLEXCONTAINER);
request.setReturnContentType(MimeMediaType.OBJ);
request.setContent(flexContainer);
-
- return sendRequest(cseService, request);
+ return cseService.doRequest(request);
}
-
/**
* Retrieve a resource
* @param cseService
* @param uri
* @return response
*/
- public static ResponsePrimitive sendRetrieveRequest(CseService cseService, String uri) {
+ public static ResponsePrimitive sendRetrieveRequest(String uri) {
RequestPrimitive request = new RequestPrimitive();
-
request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);
request.setTo(uri);
request.setOperation(Operation.RETRIEVE);
request.setRequestContentType(MimeMediaType.OBJ);
request.setReturnContentType(MimeMediaType.OBJ);
-
- return sendRequest(cseService, request);
+ return cseService.doRequest(request);
}
/**
@@ -217,26 +267,12 @@
* location of the to be deleted resource
* @return ResponsePrimitive sent by the CSE
*/
- public static ResponsePrimitive sendDeleteRequest(CseService cseService, String resourceLocation) {
+ public static ResponsePrimitive sendDeleteRequest(String resourceLocation) {
RequestPrimitive request = new RequestPrimitive();
-
request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);
request.setTo(resourceLocation);
request.setOperation(Operation.DELETE);
-
- return sendRequest(cseService, request);
- }
-
- /**
- * Send a request to the CSE
- *
- * @param cseService
- * CSe service
- * @param request
- * request to be sent
- * @return ResponsePrimitive received from the CSE
- */
- private static ResponsePrimitive sendRequest(CseService cseService, RequestPrimitive request) {
return cseService.doRequest(request);
}
+
}
diff --git a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/DeviceList.java b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/DeviceList.java
index f93db8f..e7bb745 100644
--- a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/DeviceList.java
+++ b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/DeviceList.java
@@ -10,6 +10,8 @@
import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.eclipse.om2m.sdt.Device;
/**
@@ -21,7 +23,9 @@
public class DeviceList implements DeviceListListener {
private final static DeviceList INSTANCE = new DeviceList();
-
+
+ private final static Log logger = LogFactory.getLog(DeviceList.class);
+
private List<Device> devices;
private List<DeviceListListener> listeners;
@@ -87,7 +91,7 @@
try {
listenerToBeAdded.notifyNewDevice(device);
} catch (Exception e) {
- // silent
+ logger.error("", e);
}
}
}
@@ -114,7 +118,7 @@
try {
listenerToBeRemoved.notifyDeviceRemoved(device);
} catch (Exception e) {
- // silent
+ logger.error("", e);
}
}
@@ -125,31 +129,32 @@
}
- @Override
/**
* Retrieve all listeners and notify them about new device
*/
+ @Override
public void notifyNewDevice(Device newDevice) {
for(DeviceListListener listener : getListeners()) {
try {
listener.notifyNewDevice(newDevice);
} catch (Exception e) {
+ logger.error("", e);
}
}
}
- @Override
/**
* Retrieve all listeners and notify them about device removal
*/
+ @Override
public void notifyDeviceRemoved(Device toBeRemovedDevice) {
for(DeviceListListener listener : getListeners()) {
try {
listener.notifyDeviceRemoved(toBeRemovedDevice);
} catch (Exception e) {
+ logger.error("", e);
}
}
}
-
}
diff --git a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/ModuleSDTListener.java b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/ModuleSDTListener.java
index 4aadb09..bdc8948 100644
--- a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/ModuleSDTListener.java
+++ b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/ModuleSDTListener.java
@@ -17,7 +17,6 @@
import org.eclipse.om2m.commons.resource.CustomAttribute;
import org.eclipse.om2m.commons.resource.FlexContainer;
import org.eclipse.om2m.commons.resource.ResponsePrimitive;
-import org.eclipse.om2m.core.service.CseService;
import org.eclipse.om2m.sdt.Module;
import org.eclipse.om2m.sdt.events.SDTEventListener;
import org.eclipse.om2m.sdt.events.SDTNotification;
@@ -34,15 +33,12 @@
private static Log logger = LogFactory.getLog(ModuleSDTListener.class);
- private final CseService cseService;
private final Module module;
private final String moduleFlexContainerLocation;
private ServiceRegistration<?> serviceRegistration;
- public ModuleSDTListener(final Module pModule, final CseService pCseService,
- final String pModuleFlexContainerLocation) {
- this.cseService = pCseService;
+ public ModuleSDTListener(final Module pModule, final String pModuleFlexContainerLocation) {
this.module = pModule;
this.moduleFlexContainerLocation = pModuleFlexContainerLocation;
}
@@ -87,8 +83,8 @@
ca.setCustomAttributeValue((value != null ? value.toString() : null));
toBeUpdated.getCustomAttributes().add(ca);
- ResponsePrimitive response = CseUtil.sendInternalNotifyFlexContainerRequest(cseService,
- toBeUpdated, moduleFlexContainerLocation);
+ ResponsePrimitive response = CseUtil.sendInternalNotifyFlexContainerRequest(toBeUpdated,
+ moduleFlexContainerLocation);
if (! ResponseStatusCode.UPDATED.equals(response.getResponseStatusCode())) {
logger.info("unable to send INTERNAL NOTIFY request to flexContainer "
+ moduleFlexContainerLocation + " : " + response.getContent(),
diff --git a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTActionAdaptor.java b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTActionAdaptor.java
index f160c0b..363da68 100644
--- a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTActionAdaptor.java
+++ b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTActionAdaptor.java
@@ -14,7 +14,6 @@
import org.eclipse.om2m.commons.resource.CustomAttribute;
import org.eclipse.om2m.commons.resource.ResponsePrimitive;
import org.eclipse.om2m.commons.resource.flexcontainerspec.FlexContainerFactory;
-import org.eclipse.om2m.core.service.CseService;
import org.eclipse.om2m.ipe.sdt.flexcontainerservice.ActionFlexContainerService;
import org.eclipse.om2m.sdt.Action;
import org.eclipse.om2m.sdt.Arg;
@@ -27,7 +26,6 @@
private static final String SEP = "/";
private final boolean hasToBeAnnounced;
- private final CseService cseService;
private final String parentLocation;
private final String resourceLocation;
private final String resourceName;
@@ -37,9 +35,8 @@
private ActionFlexContainerService actionFlexContainerService;
- public SDTActionAdaptor(final CseService pCseService, final Action pAction,
+ public SDTActionAdaptor(final Action pAction,
final String pParentLocation, final Module pModule, final String announceCseId, final boolean hasToBeAnnounced) {
- this.cseService = pCseService;
this.hasToBeAnnounced = hasToBeAnnounced;
this.action = pAction;
this.parentLocation = pParentLocation;
@@ -72,8 +69,8 @@
actionFlexContainer.getCustomAttributes().add(customAttribute);
}
- ResponsePrimitive response = CseUtil.sendCreateFlexContainerRequest(cseService,
- actionFlexContainer, parentLocation);
+ ResponsePrimitive response = CseUtil.sendCreateFlexContainerRequest(actionFlexContainer,
+ parentLocation);
if (! response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {
logger.error("unable to create a FlexContainer for action " + action.getName()
+ ":" + response.getContent(), null);
@@ -92,7 +89,7 @@
public void unpublishActionFromOM2MTree() {
logger.info("unpublishActionFromOM2MTree(name=" + this.action.getName()
+ ", location=" + resourceLocation + ")");
- CseUtil.sendDeleteRequest(cseService, resourceLocation);
+ CseUtil.sendDeleteRequest(resourceLocation);
}
}
diff --git a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTDeviceAdaptor.java b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTDeviceAdaptor.java
index 7d17a02..3a5f5bb 100644
--- a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTDeviceAdaptor.java
+++ b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTDeviceAdaptor.java
@@ -15,31 +15,35 @@
import org.eclipse.om2m.commons.constants.ResponseStatusCode;
import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
import org.eclipse.om2m.commons.resource.CustomAttribute;
+import org.eclipse.om2m.commons.resource.DeviceInfo;
+import org.eclipse.om2m.commons.resource.MgmtObj;
+import org.eclipse.om2m.commons.resource.Node;
import org.eclipse.om2m.commons.resource.ResponsePrimitive;
import org.eclipse.om2m.commons.resource.flexcontainerspec.FlexContainerFactory;
-import org.eclipse.om2m.core.service.CseService;
import org.eclipse.om2m.sdt.Device;
import org.eclipse.om2m.sdt.Module;
import org.eclipse.om2m.sdt.Property;
+import org.eclipse.om2m.sdt.home.types.PropertyType;
public class SDTDeviceAdaptor {
- private static Log logger = LogFactory.getLog(SDTDeviceAdaptor.class);
+ private static final Log logger = LogFactory.getLog(SDTDeviceAdaptor.class);
private static final String SEP = "/";
private static final String DEVICE_PREFIX = "DEVICE_";
private final boolean hasToBeAnnounced;
private final String parentLocation;
+ private final String baseLocation;
private final String resourceLocation;
private final String resourceName;
private final Device device;
private final String adminAcpResource;
- private final CseService cseService;
private final String announceCseId;
private final String remoteCseName;
private boolean isPublished = false;
private final Map<Module, SDTModuleAdaptor> modules;
+ private String nodeLocation;
/**
*
@@ -47,19 +51,19 @@
* @param pResourceName
* @param pDevice
*/
- public SDTDeviceAdaptor(final String pParentLocation, final Device pDevice,
- final CseService pCseService, final String pAdminAcpResource,
+ public SDTDeviceAdaptor(final String pParentLocation, final String baseLocation,
+ final Device pDevice, final String pAdminAcpResource,
final String pAnnounceCseId, final String pRemoteCseName, final boolean hasToBeAnnounced) {
this.parentLocation = pParentLocation;
+ this.baseLocation = baseLocation;
this.hasToBeAnnounced = hasToBeAnnounced;
this.device = pDevice;
this.resourceName = DEVICE_PREFIX + device.getId();
this.resourceLocation = parentLocation + SEP + resourceName;
- this.cseService = pCseService;
this.announceCseId = pAnnounceCseId;
this.remoteCseName = pRemoteCseName;
this.adminAcpResource = pAdminAcpResource;
- modules = new HashMap<>();
+ modules = new HashMap<Module, SDTModuleAdaptor>();
}
/**
@@ -93,6 +97,15 @@
// if we reach this point, we are sure the FlexContainer resource has
// been created into the oneM2M tree
isPublished = true;
+
+ Node node = new Node();
+ node.setNodeID("Node-" + resourceName);
+ node.getAccessControlPolicyIDs().add(adminAcpResource);
+ if (hasToBeAnnounced) {
+ node.getAnnounceTo().add(SEP + announceCseId);
+ }
+ DeviceInfo devInfo = new DeviceInfo();
+ node.getMgmtObjs().add(devInfo);
// SDT properties are customAttribute of the device FlexContainer
for (Property sdtProperty : device.getProperties()) {
@@ -100,32 +113,79 @@
+ ", value=" + sdtProperty.getValue() + ", type=" + sdtProperty.getType() + ")");
if (sdtProperty.getType() != null) {
-
+
if ((sdtProperty.getValue() == null) && (sdtProperty.isOptional())) {
// do not add this property because it is null and optional
continue;
}
-
- CustomAttribute customAttributeForSdtProperty = new CustomAttribute();
- customAttributeForSdtProperty.setCustomAttributeName(sdtProperty.getShortName());
- customAttributeForSdtProperty.setCustomAttributeValue(sdtProperty.getValue());
-
- logger.info("new Property CustomAttribute (" + customAttributeForSdtProperty + ")");
- flexContainer.getCustomAttributes().add(customAttributeForSdtProperty);
+ String shortName = sdtProperty.getShortName();
+ if (shortName.equals(PropertyType.deviceSerialNum.getShortName())) {
+ devInfo.setDeviceLabel(sdtProperty.getValue());
+ } else if (shortName.equals(PropertyType.deviceFirmwareVersion.getShortName())) {
+ devInfo.setFwVersion(sdtProperty.getValue());
+ } else if (shortName.equals(PropertyType.deviceManufacturer.getShortName())) {
+ devInfo.setManufacturer(sdtProperty.getValue());
+ } else if (shortName.equals(PropertyType.deviceModelName.getShortName())) {
+ devInfo.setModel(sdtProperty.getValue());
+ } else if (shortName.equals(PropertyType.deviceType.getShortName())) {
+ devInfo.setDeviceType(sdtProperty.getValue());
+ } else if (shortName.equals(PropertyType.hardwareVersion.getShortName())) {
+ devInfo.setHwVersion(sdtProperty.getValue());
+ } else if (shortName.equals(PropertyType.manufacturerDetailsLink.getShortName())) {
+ devInfo.setManufacturerDetailsLink(sdtProperty.getValue());
+ } else if (shortName.equals(PropertyType.osVersion.getShortName())) {
+ devInfo.setOsVersion(sdtProperty.getValue());
+ } else if (shortName.equals(PropertyType.location.getShortName())) {
+ devInfo.setLocation(sdtProperty.getValue());
+ } else if (shortName.equals(PropertyType.country.getShortName())) {
+ devInfo.setCountry(sdtProperty.getValue());
+ } else if (shortName.equals(PropertyType.dateOfManufacture.getShortName())) {
+ devInfo.setManufacturingDate(sdtProperty.getValue());
+ } else if (shortName.equals(PropertyType.supportURL.getShortName())) {
+ devInfo.setSupportURL(sdtProperty.getValue());
+ } else if (shortName.equals(PropertyType.deviceSubModelName.getShortName())) {
+ devInfo.setSubModel(sdtProperty.getValue());
+ } else if (shortName.equals(PropertyType.deviceName.getShortName())) {
+ devInfo.setDeviceName(sdtProperty.getValue());
+ } else if (shortName.equals(PropertyType.presentationURL.getShortName())) {
+ devInfo.setPresentationURL(sdtProperty.getValue());
+ } else if (shortName.equals(PropertyType.protocol.getShortName())) {
+ devInfo.setProtocol(sdtProperty.getValue());
+ } else {
+ CustomAttribute customAttributeForSdtProperty = new CustomAttribute();
+ customAttributeForSdtProperty.setCustomAttributeName(shortName);
+ customAttributeForSdtProperty.setCustomAttributeValue(sdtProperty.getValue());
+ logger.info("new Property CustomAttribute (" + customAttributeForSdtProperty + ")");
+ flexContainer.getCustomAttributes().add(customAttributeForSdtProperty);
+ }
}
}
- ResponsePrimitive response = CseUtil.sendCreateFlexContainerRequest(cseService,
- flexContainer, parentLocation);
+ ResponsePrimitive response = CseUtil.sendCreateFlexContainerRequest(flexContainer,
+ parentLocation);
if (! response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {
logger.error("unable to create a FlexContainer for SDT Device "
+ resourceName + " : " + response.getContent(), null);
return false;
}
+ flexContainer = (AbstractFlexContainer) response.getContent();
+
+ node.setHostedAppLinks(flexContainer.getResourceID());
+ response = CseUtil.sendCreateNodeRequest(node, devInfo, baseLocation);
+ if (! response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {
+ logger.error("unable to create a Node for SDT Device "
+ + resourceName + " : " + response.getContent(), null);
+ return false;
+ }
+ nodeLocation = ((MgmtObj)response.getContent()).getParentID();
+
+ // update
+ flexContainer.setNodeLink(nodeLocation);
+ CseUtil.sendUpdateFlexContainerRequest(flexContainer);
// Modules (must be done now because Device FlexContainer is the parent of each Module)
for (Module module : this.device.getModules()) {
- SDTModuleAdaptor sdtModuleAdaptor = new SDTModuleAdaptor(module, cseService,
+ SDTModuleAdaptor sdtModuleAdaptor = new SDTModuleAdaptor(module,
resourceLocation, announceCseId, hasToBeAnnounced);
if (sdtModuleAdaptor.publishModuleIntoOM2MTree()) {
modules.put(module, sdtModuleAdaptor);
@@ -149,7 +209,9 @@
module.unpublishModuleFromOM2MTree();
}
// send DELETE request for Device FlexContainer
- CseUtil.sendDeleteRequest(cseService, resourceLocation);
+ CseUtil.sendDeleteRequest(resourceLocation);
+ // send DELETE request for Device Node
+ CseUtil.sendDeleteRequest(nodeLocation);
}
}
diff --git a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTIpeApplication.java b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTIpeApplication.java
index 688da7f..1065a61 100644
--- a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTIpeApplication.java
+++ b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTIpeApplication.java
@@ -19,7 +19,6 @@
import org.eclipse.om2m.commons.resource.AEAnnc;
import org.eclipse.om2m.commons.resource.AccessControlPolicy;
import org.eclipse.om2m.commons.resource.ResponsePrimitive;
-import org.eclipse.om2m.core.service.CseService;
import org.eclipse.om2m.sdt.Device;
public class SDTIpeApplication implements DeviceListListener {
@@ -33,8 +32,6 @@
private static final String POA = "sdt";
- private final CseService cseService;
-
private final Map<Device, SDTDeviceAdaptor> devices = new HashMap<>();
private final String remoteCseId;
@@ -48,9 +45,8 @@
private AccessControlPolicy remoteAdminAccessControlPolicy;
private AE registeredAe;
- public SDTIpeApplication(final CseService pCseService, final String announceCseId, final String pRemoteCseName,
+ public SDTIpeApplication(final String announceCseId, final String pRemoteCseName,
final boolean ipeUnder, final boolean hasToBeAnnounced) {
- cseService = pCseService;
this.remoteCseId = announceCseId;
this.remoteCseName = pRemoteCseName;
this.ipeUnderAnnouncedResource = ipeUnder;
@@ -74,8 +70,10 @@
private boolean addSDTDevice(Device device) {
logger.info("add SDT Device (id:" + device.getId() + ", name=" + device.getName() + ") into oneM2M");
- SDTDeviceAdaptor sdtDeviceAdaptor = new SDTDeviceAdaptor(sdtIpeApplicationLocation, device, cseService,
- adminAccessControlPolicy.getResourceID(), remoteCseId, remoteCseName, hasToBeAnnounced);
+ SDTDeviceAdaptor sdtDeviceAdaptor = new SDTDeviceAdaptor(sdtIpeApplicationLocation,
+ sdtIpeBaseLocation, device,
+ adminAccessControlPolicy.getResourceID(),
+ remoteCseId, remoteCseName, hasToBeAnnounced);
if (sdtDeviceAdaptor.publishIntoOM2MTree()) {
synchronized (devices) {
devices.put(device, sdtDeviceAdaptor);
@@ -119,7 +117,7 @@
ResponsePrimitive resp = null;
try {
for (int i = 0; i < 3; i++) {
- resp = CseUtil.sendCreateApplicationEntityRequest(cseService, ae, sdtIpeBaseLocation);
+ resp = CseUtil.sendCreateApplicationEntityRequest(ae, sdtIpeBaseLocation);
if (ResponseStatusCode.CREATED.equals(resp.getResponseStatusCode())) {
// nothing do
@@ -145,13 +143,13 @@
registeredAe = (AE) resp.getContent();
}
- ResponsePrimitive response = CseUtil.sendCreateDefaultACP(cseService, sdtIpeBaseLocation,
+ ResponsePrimitive response = CseUtil.sendCreateDefaultACP(sdtIpeBaseLocation,
"ACP_Device_Admin_" + System.currentTimeMillis(), new ArrayList<String>());
adminAccessControlPolicy = (AccessControlPolicy) response.getContent();
if (/*(remoteCseId != null) && (remoteCseName != null)*/ hasToBeAnnounced) {
// remote ACP_Device_Admin
- response = CseUtil.sendCreateDefaultACP(cseService,
+ response = CseUtil.sendCreateDefaultACP(
SEP + remoteCseId + SEP + remoteCseName + SEP + Constants.CSE_NAME,
"Remote_ACP_Device_Admin" + System.currentTimeMillis(), new ArrayList<String>());
remoteAdminAccessControlPolicy = (AccessControlPolicy) response.getContent();
@@ -159,7 +157,7 @@
// update SDT_IPE_ANNC
AEAnnc sdtIpeAnnc = new AEAnnc();
sdtIpeAnnc.getAccessControlPolicyIDs().add(remoteAdminAccessControlPolicy.getResourceID());
- CseUtil.sendUpdateApplicationAnncEntityRequest(cseService, sdtIpeAnnc,
+ CseUtil.sendUpdateApplicationAnncEntityRequest(sdtIpeAnnc,
SEP + remoteCseId + SEP + remoteCseName + SEP + Constants.CSE_NAME + "/SDT_IPE_Annc");
}
}
@@ -170,7 +168,7 @@
protected void deleteIpeApplicationEntity() {
logger.info("delete ipe application");
if (registeredAe != null) {
- ResponsePrimitive response = CseUtil.sendDeleteRequest(cseService, registeredAe.getResourceID()/* sdtIpeApplicationLocation*/);
+ ResponsePrimitive response = CseUtil.sendDeleteRequest(registeredAe.getResourceID()/* sdtIpeApplicationLocation*/);
if (!response.getResponseStatusCode().equals(ResponseStatusCode.DELETED)) {
// log only
// no need to throw an exception
@@ -181,11 +179,11 @@
if (adminAccessControlPolicy != null) {
- CseUtil.sendDeleteRequest(cseService, adminAccessControlPolicy.getResourceID());
+ CseUtil.sendDeleteRequest(adminAccessControlPolicy.getResourceID());
adminAccessControlPolicy = null;
}
if (remoteAdminAccessControlPolicy != null) {
- CseUtil.sendDeleteRequest(cseService, remoteAdminAccessControlPolicy.getResourceID());
+ CseUtil.sendDeleteRequest(remoteAdminAccessControlPolicy.getResourceID());
remoteAdminAccessControlPolicy = null;
}
}
diff --git a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTModuleAdaptor.java b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTModuleAdaptor.java
index 5382482..a753fe0 100644
--- a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTModuleAdaptor.java
+++ b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTModuleAdaptor.java
@@ -39,7 +39,6 @@
private final boolean hasToBeAnnounced;
private final Module module;
- private final CseService cseService;
private final String parentLocation;
private final String resourceLocation;
private final String announceCseId;
@@ -47,11 +46,9 @@
private ModuleFlexContainerService moduleFlexContainerService;
private ModuleSDTListener moduleSDTListener;
- public SDTModuleAdaptor(final Module pModule, final CseService pCseService,
- final String pParentLocation, final String pAnnounceCseId, final boolean hasToBeAnnounced) {
+ public SDTModuleAdaptor(final Module pModule, final String pParentLocation, final String pAnnounceCseId, final boolean hasToBeAnnounced) {
this.module = pModule;
this.hasToBeAnnounced = hasToBeAnnounced;
- this.cseService = pCseService;
this.parentLocation = pParentLocation;
this.resourceLocation = this.parentLocation + SEP + this.module.getName();
this.announceCseId = pAnnounceCseId;
@@ -155,7 +152,7 @@
}
logger.info("customAttributes: " + flexContainer.getCustomAttributes());
- ResponsePrimitive resp = CseUtil.sendCreateFlexContainerRequest(cseService, flexContainer,
+ ResponsePrimitive resp = CseUtil.sendCreateFlexContainerRequest(flexContainer,
parentLocation);
if (! resp.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {
logger.error("publishModuleFromOM2MTree(name=" + this.module.getName()
@@ -171,7 +168,7 @@
// publish actions
for (Action action : module.getActions()) {
- SDTActionAdaptor actionAdaptor = new SDTActionAdaptor(cseService, action,
+ SDTActionAdaptor actionAdaptor = new SDTActionAdaptor(action,
resourceLocation, module, announceCseId, hasToBeAnnounced);
if (actionAdaptor.publishActionIntoOM2MTree()) {
actions.put(action.getName(), actionAdaptor);
@@ -182,7 +179,7 @@
}
}
- moduleSDTListener = new ModuleSDTListener(module, cseService, resourceLocation);
+ moduleSDTListener = new ModuleSDTListener(module, resourceLocation);
moduleSDTListener.register();
return true;
}
@@ -204,7 +201,7 @@
}
// remove Module FlexContainer
- CseUtil.sendDeleteRequest(cseService, resourceLocation);
+ CseUtil.sendDeleteRequest(resourceLocation);
}
}
diff --git a/org.eclipse.om2m.persistence.eclipselink/META-INF/persistence.xml b/org.eclipse.om2m.persistence.eclipselink/META-INF/persistence.xml
index 8c1fbe0..b21a7de 100644
--- a/org.eclipse.om2m.persistence.eclipselink/META-INF/persistence.xml
+++ b/org.eclipse.om2m.persistence.eclipselink/META-INF/persistence.xml
@@ -35,6 +35,7 @@
<class>org.eclipse.om2m.commons.entities.AeAnncEntity</class>
<class>org.eclipse.om2m.commons.entities.AreaNwkDeviceInfoEntity</class>
<class>org.eclipse.om2m.commons.entities.AreaNwkInfoEntity</class>
+ <class>org.eclipse.om2m.commons.entities.DeviceInfoEntity</class>
<class>org.eclipse.om2m.commons.entities.CSEBaseEntity</class>
<class>org.eclipse.om2m.commons.entities.ContainerEntity</class>
<class>org.eclipse.om2m.commons.entities.DynamicAuthorizationConsultationEntity</class>
diff --git a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/DAOFactoryImpl.java b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/DAOFactoryImpl.java
index 5347960..a49f637 100644
--- a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/DAOFactoryImpl.java
+++ b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/DAOFactoryImpl.java
@@ -23,14 +23,16 @@
import org.eclipse.om2m.commons.entities.AccessControlPolicyEntity;
import org.eclipse.om2m.commons.entities.AeAnncEntity;
import org.eclipse.om2m.commons.entities.AeEntity;
-import org.eclipse.om2m.commons.entities.CreatedAnnouncedResourceEntity;
-import org.eclipse.om2m.commons.entities.DynamicAuthorizationConsultationEntity;
import org.eclipse.om2m.commons.entities.CSEBaseEntity;
import org.eclipse.om2m.commons.entities.ContainerEntity;
import org.eclipse.om2m.commons.entities.ContentInstanceEntity;
+import org.eclipse.om2m.commons.entities.CreatedAnnouncedResourceEntity;
+import org.eclipse.om2m.commons.entities.DynamicAuthorizationConsultationEntity;
import org.eclipse.om2m.commons.entities.FlexContainerEntity;
import org.eclipse.om2m.commons.entities.GroupEntity;
import org.eclipse.om2m.commons.entities.LabelEntity;
+import org.eclipse.om2m.commons.entities.MgmtObjAnncEntity;
+import org.eclipse.om2m.commons.entities.MgmtObjEntity;
import org.eclipse.om2m.commons.entities.NodeEntity;
import org.eclipse.om2m.commons.entities.PollingChannelEntity;
import org.eclipse.om2m.commons.entities.RemoteCSEEntity;
@@ -39,21 +41,23 @@
import org.eclipse.om2m.commons.entities.UriMapperEntity;
import org.eclipse.om2m.persistence.eclipselink.internal.dao.AccessControlOriginatorDAO;
import org.eclipse.om2m.persistence.eclipselink.internal.dao.AccessControlPolicyDAO;
-import org.eclipse.om2m.persistence.eclipselink.internal.dao.AeByAppIdDAO;
import org.eclipse.om2m.persistence.eclipselink.internal.dao.AeAnncDAO;
+import org.eclipse.om2m.persistence.eclipselink.internal.dao.AeByAppIdDAO;
import org.eclipse.om2m.persistence.eclipselink.internal.dao.AeDAO;
-import org.eclipse.om2m.persistence.eclipselink.internal.dao.CreatedAnnouncedResourceDAO;
-import org.eclipse.om2m.persistence.eclipselink.internal.dao.DynamicAuthorizationConsultationDAO;
import org.eclipse.om2m.persistence.eclipselink.internal.dao.CSEBaseDAO;
import org.eclipse.om2m.persistence.eclipselink.internal.dao.ContainerByNameDAO;
-import org.eclipse.om2m.persistence.eclipselink.internal.dao.DescContainerByParentDAO;
import org.eclipse.om2m.persistence.eclipselink.internal.dao.ContainerDAO;
import org.eclipse.om2m.persistence.eclipselink.internal.dao.ContentInstanceDAO;
+import org.eclipse.om2m.persistence.eclipselink.internal.dao.CreatedAnnouncedResourceDAO;
+import org.eclipse.om2m.persistence.eclipselink.internal.dao.DescContainerByParentDAO;
+import org.eclipse.om2m.persistence.eclipselink.internal.dao.DynamicAuthorizationConsultationDAO;
import org.eclipse.om2m.persistence.eclipselink.internal.dao.FlexContainerAnncDAO;
import org.eclipse.om2m.persistence.eclipselink.internal.dao.FlexContainerDAO;
import org.eclipse.om2m.persistence.eclipselink.internal.dao.GroupDAO;
import org.eclipse.om2m.persistence.eclipselink.internal.dao.LabelDAO;
-import org.eclipse.om2m.persistence.eclipselink.internal.dao.NodeEntityDAO;
+import org.eclipse.om2m.persistence.eclipselink.internal.dao.MgmtObjAnncDAO;
+import org.eclipse.om2m.persistence.eclipselink.internal.dao.MgmtObjDAO;
+import org.eclipse.om2m.persistence.eclipselink.internal.dao.NodeDAO;
import org.eclipse.om2m.persistence.eclipselink.internal.dao.OldestDAO;
import org.eclipse.om2m.persistence.eclipselink.internal.dao.PollingChannelDAO;
import org.eclipse.om2m.persistence.eclipselink.internal.dao.RemoteCSEByIdDAO;
@@ -153,16 +157,19 @@
}
@Override
- public DAO<NodeEntity> getNodeEntityDAO() {
- return new NodeEntityDAO();
+ public DAO<NodeEntity> getNodeDAO() {
+ return new NodeDAO();
+ }
+
+ @Override
+ public DAO<MgmtObjEntity> getMgmtObjDAO() {
+ return new MgmtObjDAO();
}
@Override
public DAO<AccessControlOriginatorEntity> getAccessControlOriginatorDAO() {
return new AccessControlOriginatorDAO();
}
-
-
@Override
public DAO<AeAnncEntity> getAeAnncDAO() {
@@ -188,4 +195,10 @@
public DAO<ContentInstanceEntity> getOldestDAO() {
return new OldestDAO();
}
+
+ @Override
+ public DAO<MgmtObjAnncEntity> getMgmtObjAnncDAO() {
+ return new MgmtObjAnncDAO();
+ }
+
}
diff --git a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AccessControlOriginatorDAO.java b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AccessControlOriginatorDAO.java
index ff5bb9e..f566d9c 100644
--- a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AccessControlOriginatorDAO.java
+++ b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AccessControlOriginatorDAO.java
@@ -35,21 +35,10 @@
@Override
public AccessControlOriginatorEntity find(DBTransaction dbTransaction, Object id) {
DBTransactionJPAImpl transaction = (DBTransactionJPAImpl) dbTransaction;
-
-
List<AccessControlOriginatorEntity> acoes = transaction.getEm().createQuery("select a from "
+ DBEntities.ACCESSCONTROLORIGINATOR_ENTITY + " a where a.originatorID =\'" + id + "\'")
.getResultList();
-
- for (AccessControlOriginatorEntity acoe : acoes) {
- }
- if (acoes.size() > 0) {
-
- return acoes.get(0);
- } else {
- return null;
- }
-
+ return acoes.isEmpty() ? null : acoes.get(0);
}
@Override
diff --git a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AccessControlPolicyDAO.java b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AccessControlPolicyDAO.java
index a61982d..8eb9afe 100644
--- a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AccessControlPolicyDAO.java
+++ b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AccessControlPolicyDAO.java
@@ -19,7 +19,6 @@
*******************************************************************************/
package org.eclipse.om2m.persistence.eclipselink.internal.dao;
-import java.util.ArrayList;
import java.util.List;
import org.eclipse.om2m.commons.entities.AccessControlPolicyEntity;
@@ -28,6 +27,8 @@
import org.eclipse.om2m.commons.entities.FlexContainerAnncEntity;
import org.eclipse.om2m.commons.entities.FlexContainerEntity;
import org.eclipse.om2m.commons.entities.LabelEntity;
+import org.eclipse.om2m.commons.entities.MgmtObjEntity;
+import org.eclipse.om2m.commons.entities.NodeEntity;
import org.eclipse.om2m.persistence.eclipselink.internal.DBTransactionJPAImpl;
import org.eclipse.om2m.persistence.service.DBTransaction;
@@ -89,7 +90,17 @@
for (FlexContainerAnncEntity entity : resource.getLinkedFlexContainerAs()) {
entity.getAccessControlPolicies().remove(resource);
}
-
+
+ // remove node link
+ for (NodeEntity entity : resource.getLinkedNodes()) {
+ entity.getAccessControlPolicies().remove(resource);
+ }
+
+ // remove mgmt objects link
+ for (MgmtObjEntity entity : resource.getMgmtObjEntities()) {
+ entity.getAccessControlPolicies().remove(resource);
+ }
+
if (resource.getParentAE() != null) {
resource.getParentAE().getChildAccessControlPolicies().remove(resource);
}
diff --git a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AeAnncDAO.java b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AeAnncDAO.java
index 415018e..0877566 100644
--- a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AeAnncDAO.java
+++ b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AeAnncDAO.java
@@ -22,9 +22,7 @@
import java.util.List;
import org.eclipse.om2m.commons.entities.AeAnncEntity;
-import org.eclipse.om2m.commons.entities.CSEBaseEntity;
import org.eclipse.om2m.commons.entities.LabelEntity;
-import org.eclipse.om2m.commons.entities.RemoteCSEEntity;
import org.eclipse.om2m.persistence.eclipselink.internal.DBTransactionJPAImpl;
import org.eclipse.om2m.persistence.service.DBTransaction;
diff --git a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AeDAO.java b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AeDAO.java
index 0030636..9dcfeee 100644
--- a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AeDAO.java
+++ b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AeDAO.java
@@ -22,10 +22,7 @@
import java.util.List;
import org.eclipse.om2m.commons.entities.AeEntity;
-import org.eclipse.om2m.commons.entities.CSEBaseEntity;
import org.eclipse.om2m.commons.entities.LabelEntity;
-import org.eclipse.om2m.commons.entities.RemoteCSEEntity;
-import org.eclipse.om2m.commons.entities.RemoteCseAnncEntity;
import org.eclipse.om2m.persistence.eclipselink.internal.DBTransactionJPAImpl;
import org.eclipse.om2m.persistence.service.DBTransaction;
diff --git a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AreaNwkInfoDAO.java b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AreaNwkInfoDAO.java
deleted file mode 100644
index 9631903..0000000
--- a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AreaNwkInfoDAO.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013-2016 LAAS-CNRS (www.laas.fr)
- * 7 Colonel Roche 31077 Toulouse - France
- *
- * 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
- *
- * Initial Contributors:
- * Thierry Monteil : Project manager, technical co-manager
- * Mahdi Ben Alaya : Technical co-manager
- * Samir Medjiah : Technical co-manager
- * Khalil Drira : Strategy expert
- * Guillaume Garzone : Developer
- * François Aïssaoui : Developer
- *
- * New contributors :
- *******************************************************************************/
-package org.eclipse.om2m.persistence.eclipselink.internal.dao;
-
-import org.eclipse.om2m.commons.entities.AreaNwkInfoEntity;
-import org.eclipse.om2m.commons.entities.NodeEntity;
-import org.eclipse.om2m.persistence.eclipselink.internal.DBTransactionJPAImpl;
-import org.eclipse.om2m.persistence.service.DBTransaction;
-
-/**
- * DAO for the Area Network Info Management Object
- *
- */
-public class AreaNwkInfoDAO extends AbstractDAO<AreaNwkInfoEntity> {
-
- @Override
- public AreaNwkInfoEntity find(DBTransaction dbTransaction, Object id) {
- DBTransactionJPAImpl transaction = (DBTransactionJPAImpl) dbTransaction;
- return transaction.getEm().find(AreaNwkInfoEntity.class, id);
- }
-
- @Override
- public void delete(DBTransaction dbTransaction, AreaNwkInfoEntity resource) {
- DBTransactionJPAImpl transaction = (DBTransactionJPAImpl) dbTransaction;
- transaction.getEm().remove(resource);
- // cleaning the cache
- transaction.getEm().getEntityManagerFactory().getCache().evict(NodeEntity.class);
- }
-
-}
diff --git a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AreaNwkInfoDeviceDAO.java b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AreaNwkInfoDeviceDAO.java
deleted file mode 100644
index 664df42..0000000
--- a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AreaNwkInfoDeviceDAO.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013-2016 LAAS-CNRS (www.laas.fr)
- * 7 Colonel Roche 31077 Toulouse - France
- *
- * 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
- *
- * Initial Contributors:
- * Thierry Monteil : Project manager, technical co-manager
- * Mahdi Ben Alaya : Technical co-manager
- * Samir Medjiah : Technical co-manager
- * Khalil Drira : Strategy expert
- * Guillaume Garzone : Developer
- * François Aïssaoui : Developer
- *
- * New contributors :
- *******************************************************************************/
-package org.eclipse.om2m.persistence.eclipselink.internal.dao;
-
-import org.eclipse.om2m.commons.entities.AreaNwkDeviceInfoEntity;
-import org.eclipse.om2m.commons.entities.NodeEntity;
-import org.eclipse.om2m.persistence.eclipselink.internal.DBTransactionJPAImpl;
-import org.eclipse.om2m.persistence.service.DBTransaction;
-
-/**
- * DAO for the Area Network Device Info Management Object
- *
- */
-public class AreaNwkInfoDeviceDAO extends AbstractDAO<AreaNwkDeviceInfoEntity> {
-
- @Override
- public AreaNwkDeviceInfoEntity find(DBTransaction dbTransaction, Object id) {
- DBTransactionJPAImpl transaction = (DBTransactionJPAImpl) dbTransaction;
- return transaction.getEm().find(AreaNwkDeviceInfoEntity.class, id);
- }
-
- @Override
- public void delete(DBTransaction dbTransaction,
- AreaNwkDeviceInfoEntity resource) {
- DBTransactionJPAImpl transaction = (DBTransactionJPAImpl) dbTransaction;
- transaction.getEm().remove(resource);
- // clean the cache
- transaction.getEm().getEntityManagerFactory().getCache().evict(NodeEntity.class);
- }
-
-
-}
diff --git a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/DynamicAuthorizationConsultationDAO.java b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/DynamicAuthorizationConsultationDAO.java
index ac6f76c..06828ed 100644
--- a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/DynamicAuthorizationConsultationDAO.java
+++ b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/DynamicAuthorizationConsultationDAO.java
@@ -5,8 +5,6 @@
import org.eclipse.om2m.commons.entities.AccessControlPolicyEntity;
import org.eclipse.om2m.commons.entities.AeAnncEntity;
import org.eclipse.om2m.commons.entities.AeEntity;
-import org.eclipse.om2m.commons.entities.AreaNwkDeviceInfoEntity;
-import org.eclipse.om2m.commons.entities.AreaNwkInfoEntity;
import org.eclipse.om2m.commons.entities.CSEBaseEntity;
import org.eclipse.om2m.commons.entities.ContainerEntity;
import org.eclipse.om2m.commons.entities.ContentInstanceEntity;
@@ -15,6 +13,7 @@
import org.eclipse.om2m.commons.entities.FlexContainerEntity;
import org.eclipse.om2m.commons.entities.GroupEntity;
import org.eclipse.om2m.commons.entities.LabelEntity;
+import org.eclipse.om2m.commons.entities.MgmtObjEntity;
import org.eclipse.om2m.commons.entities.NodeEntity;
import org.eclipse.om2m.commons.entities.RemoteCSEEntity;
import org.eclipse.om2m.commons.entities.ScheduleEntity;
@@ -83,16 +82,10 @@
transaction.getEm().merge(ae);
}
- // remove link with AreaNwkDeviceInfo
- for(AreaNwkDeviceInfoEntity andie : resource.getLinkedAreaNwkDeviceInfoEntities()) {
- andie.getDynamicAuthorizationConsultations().remove(resource);
- transaction.getEm().merge(andie);
- }
-
- // remove link with AreaNwkInfo
- for(AreaNwkInfoEntity anie : resource.getLinkedAreaNwkInfoEntities()) {
- anie.getDynamicAuthorizationConsultations().remove(resource);
- transaction.getEm().merge(anie);
+ // remove link with Mgmt Objs
+ for(MgmtObjEntity mgmtObj : resource.getMgmtObjEntities()) {
+ mgmtObj.getDynamicAuthorizationConsultations().remove(resource);
+ transaction.getEm().merge(mgmtObj);
}
// remove link with Container
diff --git a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/FlexContainerAnncDAO.java b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/FlexContainerAnncDAO.java
index 691a9dd..a8ea5bb 100644
--- a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/FlexContainerAnncDAO.java
+++ b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/FlexContainerAnncDAO.java
@@ -2,7 +2,6 @@
import java.util.List;
-import org.eclipse.om2m.commons.entities.AeAnncEntity;
import org.eclipse.om2m.commons.entities.FlexContainerAnncEntity;
import org.eclipse.om2m.commons.entities.LabelEntity;
import org.eclipse.om2m.persistence.eclipselink.internal.DBTransactionJPAImpl;
diff --git a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/FlexContainerDAO.java b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/FlexContainerDAO.java
index acb5afc..49338b6 100644
--- a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/FlexContainerDAO.java
+++ b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/FlexContainerDAO.java
@@ -9,13 +9,8 @@
import java.util.List;
-import org.eclipse.om2m.commons.entities.AeAnncEntity;
-import org.eclipse.om2m.commons.entities.AeEntity;
-import org.eclipse.om2m.commons.entities.CSEBaseEntity;
import org.eclipse.om2m.commons.entities.FlexContainerEntity;
import org.eclipse.om2m.commons.entities.LabelEntity;
-import org.eclipse.om2m.commons.entities.RemoteCSEEntity;
-import org.eclipse.om2m.commons.entities.RemoteCseAnncEntity;
import org.eclipse.om2m.persistence.eclipselink.internal.DBTransactionJPAImpl;
import org.eclipse.om2m.persistence.service.DBTransaction;
diff --git a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/MgmtObjAnncDAO.java b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/MgmtObjAnncDAO.java
new file mode 100644
index 0000000..8e4e282
--- /dev/null
+++ b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/MgmtObjAnncDAO.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 2016 Orange.
+ * 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.om2m.persistence.eclipselink.internal.dao;
+
+import java.math.BigInteger;
+
+import org.eclipse.om2m.commons.entities.AreaNwkDeviceInfoEntity;
+import org.eclipse.om2m.commons.entities.AreaNwkInfoEntity;
+import org.eclipse.om2m.commons.entities.DeviceInfoEntity;
+import org.eclipse.om2m.commons.entities.MgmtObjAnncEntity;
+import org.eclipse.om2m.commons.entities.MgmtObjEntity;
+import org.eclipse.om2m.commons.entities.NodeEntity;
+import org.eclipse.om2m.persistence.eclipselink.internal.DBTransactionJPAImpl;
+import org.eclipse.om2m.persistence.service.DBTransaction;
+
+public class MgmtObjAnncDAO extends AbstractDAO<MgmtObjAnncEntity> {
+
+ private AbstractDAO<DeviceInfoEntity> deviceInfoDAO;
+ private AbstractDAO<AreaNwkInfoEntity> areaNwkInfoDAO;
+ private AbstractDAO<AreaNwkDeviceInfoEntity> areaNwkDeviceInfoDAO;
+
+
+ public MgmtObjAnncDAO() {
+ deviceInfoDAO = new AbstractDAO<DeviceInfoEntity>() {
+ @Override
+ public DeviceInfoEntity find(DBTransaction dbTransaction, Object id) {
+ DBTransactionJPAImpl transaction = (DBTransactionJPAImpl) dbTransaction;
+ return transaction.getEm().find(DeviceInfoEntity.class, id);
+ }
+ @Override
+ public void delete(DBTransaction dbTransaction, DeviceInfoEntity resource) {
+ }
+ };
+
+ areaNwkInfoDAO = new AbstractDAO<AreaNwkInfoEntity>() {
+ @Override
+ public AreaNwkInfoEntity find(DBTransaction dbTransaction, Object id) {
+ DBTransactionJPAImpl transaction = (DBTransactionJPAImpl) dbTransaction;
+ return transaction.getEm().find(AreaNwkInfoEntity.class, id);
+ }
+ @Override
+ public void delete(DBTransaction dbTransaction, AreaNwkInfoEntity resource) {
+ }
+ };
+
+ areaNwkDeviceInfoDAO = new AbstractDAO<AreaNwkDeviceInfoEntity>() {
+ @Override
+ public AreaNwkDeviceInfoEntity find(DBTransaction dbTransaction, Object id) {
+ DBTransactionJPAImpl transaction = (DBTransactionJPAImpl) dbTransaction;
+ return transaction.getEm().find(AreaNwkDeviceInfoEntity.class, id);
+ }
+ @Override
+ public void delete(DBTransaction dbTransaction, AreaNwkDeviceInfoEntity resource) {
+ }
+ };
+ }
+
+ @Override
+ public void create(DBTransaction dbTransaction, MgmtObjAnncEntity resource) {
+ // TODO
+ BigInteger mgd = resource.getMgmtDefinition();
+// if (mgd.equals(MgmtDefinitionTypes.AREA_NWK_INFO))
+// areaNwkInfoDAO.create(dbTransaction, (AreaNwkInfoEntity) resource);
+// else if (mgd.equals(MgmtDefinitionTypes.AREA_NWK_DEVICE_INFO))
+// areaNwkDeviceInfoDAO.create(dbTransaction, (AreaNwkDeviceInfoEntity) resource);
+// else if (mgd.equals(MgmtDefinitionTypes.DEVICE_INFO))
+// deviceInfoDAO.create(dbTransaction, (DeviceInfoEntity) resource);
+// else
+ throw new UnsupportedOperationException("Not implemented");
+ }
+
+ @Override
+ public MgmtObjAnncEntity find(DBTransaction dbTransaction, Object id) {
+ // TODO
+ MgmtObjEntity ret = deviceInfoDAO.find(dbTransaction, id);
+// if (ret != null) return ret;
+// ret = areaNwkInfoDAO.find(dbTransaction, id);
+// if (ret != null) return ret;
+// ret = areaNwkDeviceInfoDAO.find(dbTransaction, id);
+// if (ret != null) return ret;
+ return null;
+ }
+
+ @Override
+ public void delete(DBTransaction dbTransaction, MgmtObjAnncEntity resource) {
+ DBTransactionJPAImpl transaction = (DBTransactionJPAImpl) dbTransaction;
+// if (resource.getParentAE() != null) {
+// resource.getParentAE().getChildFlexContainers().remove(resource);
+// }
+ transaction.getEm().remove(resource);
+ // cleaning the cache
+ transaction.getEm().getEntityManagerFactory().getCache().evict(NodeEntity.class);
+ }
+
+}
diff --git a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/MgmtObjDAO.java b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/MgmtObjDAO.java
new file mode 100644
index 0000000..e84f056
--- /dev/null
+++ b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/MgmtObjDAO.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 2016 Orange.
+ * 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.om2m.persistence.eclipselink.internal.dao;
+
+import java.math.BigInteger;
+
+import org.eclipse.om2m.commons.constants.MgmtDefinitionTypes;
+import org.eclipse.om2m.commons.entities.AreaNwkDeviceInfoEntity;
+import org.eclipse.om2m.commons.entities.AreaNwkInfoEntity;
+import org.eclipse.om2m.commons.entities.DeviceInfoEntity;
+import org.eclipse.om2m.commons.entities.MgmtObjEntity;
+import org.eclipse.om2m.commons.entities.NodeEntity;
+import org.eclipse.om2m.persistence.eclipselink.internal.DBTransactionJPAImpl;
+import org.eclipse.om2m.persistence.service.DBTransaction;
+
+public class MgmtObjDAO extends AbstractDAO<MgmtObjEntity> {
+
+ private AbstractDAO<DeviceInfoEntity> deviceInfoDAO;
+ private AbstractDAO<AreaNwkInfoEntity> areaNwkInfoDAO;
+ private AbstractDAO<AreaNwkDeviceInfoEntity> areaNwkDeviceInfoDAO;
+
+ public MgmtObjDAO() {
+ deviceInfoDAO = new AbstractDAO<DeviceInfoEntity>() {
+ @Override
+ public DeviceInfoEntity find(DBTransaction dbTransaction, Object id) {
+ DBTransactionJPAImpl transaction = (DBTransactionJPAImpl) dbTransaction;
+ return transaction.getEm().find(DeviceInfoEntity.class, id);
+ }
+ @Override
+ public void delete(DBTransaction dbTransaction, DeviceInfoEntity resource) {
+ }
+ };
+
+ areaNwkInfoDAO = new AbstractDAO<AreaNwkInfoEntity>() {
+ @Override
+ public AreaNwkInfoEntity find(DBTransaction dbTransaction, Object id) {
+ DBTransactionJPAImpl transaction = (DBTransactionJPAImpl) dbTransaction;
+ return transaction.getEm().find(AreaNwkInfoEntity.class, id);
+ }
+ @Override
+ public void delete(DBTransaction dbTransaction, AreaNwkInfoEntity resource) {
+ }
+ };
+
+ areaNwkDeviceInfoDAO = new AbstractDAO<AreaNwkDeviceInfoEntity>() {
+ @Override
+ public AreaNwkDeviceInfoEntity find(DBTransaction dbTransaction, Object id) {
+ DBTransactionJPAImpl transaction = (DBTransactionJPAImpl) dbTransaction;
+ return transaction.getEm().find(AreaNwkDeviceInfoEntity.class, id);
+ }
+ @Override
+ public void delete(DBTransaction dbTransaction, AreaNwkDeviceInfoEntity resource) {
+ }
+ };
+ }
+
+ @Override
+ public void create(DBTransaction dbTransaction, MgmtObjEntity resource) {
+ BigInteger mgd = resource.getMgmtDefinition();
+ if (mgd.equals(MgmtDefinitionTypes.AREA_NWK_INFO))
+ areaNwkInfoDAO.create(dbTransaction, (AreaNwkInfoEntity) resource);
+ else if (mgd.equals(MgmtDefinitionTypes.AREA_NWK_DEVICE_INFO))
+ areaNwkDeviceInfoDAO.create(dbTransaction, (AreaNwkDeviceInfoEntity) resource);
+ else if (mgd.equals(MgmtDefinitionTypes.DEVICE_INFO))
+ deviceInfoDAO.create(dbTransaction, (DeviceInfoEntity) resource);
+ else
+ throw new UnsupportedOperationException("Not implemented");
+ }
+
+ @Override
+ public MgmtObjEntity find(DBTransaction dbTransaction, Object id) {
+ MgmtObjEntity ret = deviceInfoDAO.find(dbTransaction, id);
+ if (ret != null) return ret;
+ ret = areaNwkInfoDAO.find(dbTransaction, id);
+ if (ret != null) return ret;
+ ret = areaNwkDeviceInfoDAO.find(dbTransaction, id);
+ if (ret != null) return ret;
+ return null;
+ }
+
+ @Override
+ public void delete(DBTransaction dbTransaction, MgmtObjEntity resource) {
+ DBTransactionJPAImpl transaction = (DBTransactionJPAImpl) dbTransaction;
+ if (resource.getParentNode() != null)
+ resource.getParentNode().removeMgmtObj(resource);
+ transaction.getEm().remove(resource);
+ // cleaning the cache
+ transaction.getEm().getEntityManagerFactory().getCache().evict(NodeEntity.class);
+ }
+
+}
diff --git a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/NodeEntityDAO.java b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/NodeDAO.java
similarity index 92%
rename from org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/NodeEntityDAO.java
rename to org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/NodeDAO.java
index ce3b181..00d67ee 100644
--- a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/NodeEntityDAO.java
+++ b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/NodeDAO.java
@@ -28,7 +28,7 @@
import org.eclipse.om2m.persistence.eclipselink.internal.DBTransactionJPAImpl;
import org.eclipse.om2m.persistence.service.DBTransaction;
-public class NodeEntityDAO extends AbstractDAO<NodeEntity>{
+public class NodeDAO extends AbstractDAO<NodeEntity> {
@Override
public NodeEntity find(DBTransaction dbTransaction, Object id) {
@@ -46,8 +46,10 @@
@Override
public void update(DBTransaction dbTransaction, NodeEntity resource) {
+ DBTransactionJPAImpl transaction = (DBTransactionJPAImpl) dbTransaction;
List<LabelEntity> lbls = processLabels(dbTransaction, resource.getLabelsEntities());
resource.setLabelsEntities(lbls);
+ transaction.getEm().merge(resource);
super.update(dbTransaction, resource);
}
diff --git a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/OldestDAO.java b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/OldestDAO.java
index ffa9478..fd98ab6 100644
--- a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/OldestDAO.java
+++ b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/OldestDAO.java
@@ -19,7 +19,6 @@
import javax.persistence.Query;
import org.eclipse.om2m.commons.constants.DBEntities;
-import org.eclipse.om2m.commons.constants.ShortName;
import org.eclipse.om2m.commons.entities.ContentInstanceEntity;
import org.eclipse.om2m.persistence.eclipselink.internal.DBTransactionJPAImpl;
import org.eclipse.om2m.persistence.service.DBTransaction;
diff --git a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/RemoteCSEDAO.java b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/RemoteCSEDAO.java
index f556049..9ad5f53 100644
--- a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/RemoteCSEDAO.java
+++ b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/RemoteCSEDAO.java
@@ -19,7 +19,6 @@
*******************************************************************************/
package org.eclipse.om2m.persistence.eclipselink.internal.dao;
-import org.eclipse.om2m.commons.entities.CSEBaseEntity;
import org.eclipse.om2m.commons.entities.RemoteCSEEntity;
import org.eclipse.om2m.persistence.eclipselink.internal.DBTransactionJPAImpl;
import org.eclipse.om2m.persistence.service.DBTransaction;
diff --git a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/util/DynamicAuthorizationConsultationUtilImpl.java b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/util/DynamicAuthorizationConsultationUtilImpl.java
index 5070d81..650eb39 100644
--- a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/util/DynamicAuthorizationConsultationUtilImpl.java
+++ b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/util/DynamicAuthorizationConsultationUtilImpl.java
@@ -3,8 +3,6 @@
import java.util.ArrayList;
import java.util.List;
-import javax.annotation.Resource;
-import javax.persistence.Query;
import javax.persistence.TypedQuery;
import org.eclipse.om2m.commons.constants.DBEntities;
@@ -13,7 +11,6 @@
import org.eclipse.om2m.commons.entities.AeAnncEntity;
import org.eclipse.om2m.commons.entities.AeEntity;
import org.eclipse.om2m.commons.entities.CSEBaseEntity;
-import org.eclipse.om2m.commons.entities.ContainerAnncEntity;
import org.eclipse.om2m.commons.entities.ContainerEntity;
import org.eclipse.om2m.commons.entities.ContentInstanceEntity;
import org.eclipse.om2m.commons.entities.DynamicAuthorizationConsultationEntity;
@@ -24,14 +21,10 @@
import org.eclipse.om2m.commons.entities.NodeEntity;
import org.eclipse.om2m.commons.entities.PollingChannelEntity;
import org.eclipse.om2m.commons.entities.RemoteCSEEntity;
-import org.eclipse.om2m.commons.entities.RemoteCseAnncEntity;
import org.eclipse.om2m.commons.entities.RequestEntity;
import org.eclipse.om2m.commons.entities.ResourceEntity;
-import org.eclipse.om2m.commons.entities.ScheduleEntity;
import org.eclipse.om2m.commons.entities.SubscriptionEntity;
import org.eclipse.om2m.commons.entities.UriMapperEntity;
-import org.eclipse.om2m.commons.resource.M2MServiceSubscriptionProfile;
-import org.eclipse.om2m.commons.resource.RemoteCSE;
import org.eclipse.om2m.persistence.eclipselink.internal.DBServiceJPAImpl;
import org.eclipse.om2m.persistence.eclipselink.internal.DBTransactionJPAImpl;
import org.eclipse.om2m.persistence.service.util.DynamicAuthorizationConsultationUtil;
@@ -200,13 +193,18 @@
// TODO ?
break;
case ResourceType.MGMT_OBJ:
- // TODO ?
+ MgmtObjEntity mgmtObjEntity = DBServiceJPAImpl.getInstance().getDAOFactory()
+ .getMgmtObjDAO().find(dbTransaction, resourceId);
+ resourceEntity = mgmtObjEntity;
+ if (mgmtObjEntity != null) {
+ daces.addAll(mgmtObjEntity.getDynamicAuthorizationConsultations());
+ }
break;
case ResourceType.MGMT_OBJ_ANNC:
// TODO ?
break;
case ResourceType.NODE:
- NodeEntity nodeEntity = DBServiceJPAImpl.getInstance().getDAOFactory().getNodeEntityDAO().find(dbTransaction, resourceId);
+ NodeEntity nodeEntity = DBServiceJPAImpl.getInstance().getDAOFactory().getNodeDAO().find(dbTransaction, resourceId);
resourceEntity = nodeEntity;
if (nodeEntity != null) {
daces.addAll(nodeEntity.getDynamicAuthorizationConsultations());
diff --git a/org.eclipse.om2m.persistence.mongodb/src/main/java/org/eclipse/om2m/persistence/mongodb/DAOFactoryImpl.java b/org.eclipse.om2m.persistence.mongodb/src/main/java/org/eclipse/om2m/persistence/mongodb/DAOFactoryImpl.java
index 74f7d17..49428f1 100644
--- a/org.eclipse.om2m.persistence.mongodb/src/main/java/org/eclipse/om2m/persistence/mongodb/DAOFactoryImpl.java
+++ b/org.eclipse.om2m.persistence.mongodb/src/main/java/org/eclipse/om2m/persistence/mongodb/DAOFactoryImpl.java
@@ -20,6 +20,8 @@
import org.eclipse.om2m.commons.entities.FlexContainerEntity;
import org.eclipse.om2m.commons.entities.GroupEntity;
import org.eclipse.om2m.commons.entities.LabelEntity;
+import org.eclipse.om2m.commons.entities.MgmtObjAnncEntity;
+import org.eclipse.om2m.commons.entities.MgmtObjEntity;
import org.eclipse.om2m.commons.entities.NodeEntity;
import org.eclipse.om2m.commons.entities.PollingChannelEntity;
import org.eclipse.om2m.commons.entities.RemoteCSEEntity;
@@ -88,12 +90,18 @@
}
@Override
- public DAO<NodeEntity> getNodeEntityDAO() {
+ public DAO<NodeEntity> getNodeDAO() {
return new DAOImpl<NodeEntity>(NodeEntity.class) {
};
}
@Override
+ public DAO<MgmtObjEntity> getMgmtObjDAO() {
+ return new DAOImpl<MgmtObjEntity>(MgmtObjEntity.class) {
+ };
+ }
+
+ @Override
public DAO<UriMapperEntity> getUriMapperEntity() {
return new UriMapperEntityDAO();
}
@@ -157,7 +165,7 @@
@Override
public DAO<ContentInstanceEntity> getOldestDAO() {
- return new DAOImpl<ContentInstanceEntity>(ContentInstanceEntity.class) {
+ return new DAOImpl<ContentInstanceEntity>(ContentInstanceEntity.class) {
};
}
@@ -177,4 +185,10 @@
return new AeByAppIdDAO();
}
+ @Override
+ public DAO<MgmtObjAnncEntity> getMgmtObjAnncDAO() {
+ return new DAOImpl<MgmtObjAnncEntity>(MgmtObjAnncEntity.class) {
+ };
+ }
+
}
diff --git a/org.eclipse.om2m.persistence.mongodb/src/main/java/org/eclipse/om2m/persistence/mongodb/dao/LabelEntityDao.java b/org.eclipse.om2m.persistence.mongodb/src/main/java/org/eclipse/om2m/persistence/mongodb/dao/LabelEntityDao.java
index 4bd2d79..bef107c 100644
--- a/org.eclipse.om2m.persistence.mongodb/src/main/java/org/eclipse/om2m/persistence/mongodb/dao/LabelEntityDao.java
+++ b/org.eclipse.om2m.persistence.mongodb/src/main/java/org/eclipse/om2m/persistence/mongodb/dao/LabelEntityDao.java
@@ -16,14 +16,17 @@
import org.eclipse.om2m.commons.entities.AccessControlPolicyEntity;
import org.eclipse.om2m.commons.entities.AeAnncEntity;
import org.eclipse.om2m.commons.entities.AeEntity;
+import org.eclipse.om2m.commons.entities.AreaNwkDeviceInfoEntity;
import org.eclipse.om2m.commons.entities.AreaNwkInfoEntity;
import org.eclipse.om2m.commons.entities.CSEBaseEntity;
import org.eclipse.om2m.commons.entities.ContainerEntity;
import org.eclipse.om2m.commons.entities.ContentInstanceEntity;
+import org.eclipse.om2m.commons.entities.DeviceInfoEntity;
import org.eclipse.om2m.commons.entities.FlexContainerAnncEntity;
import org.eclipse.om2m.commons.entities.FlexContainerEntity;
import org.eclipse.om2m.commons.entities.GroupEntity;
import org.eclipse.om2m.commons.entities.LabelEntity;
+import org.eclipse.om2m.commons.entities.MgmtObjEntity;
import org.eclipse.om2m.commons.entities.NodeEntity;
import org.eclipse.om2m.commons.entities.RemoteCSEEntity;
import org.eclipse.om2m.persistence.mongodb.DBServiceImpl;
@@ -106,9 +109,8 @@
labelEntity.getLinkedNodes().add(nodeEntity);
break;
case(ResourceType.MGMT_OBJ):
- AreaNwkInfoEntity areaNetworkInfoEntity = DBServiceImpl.getInstance().getGson().fromJson(element.toJson(), AreaNwkInfoEntity.class);
- labelEntity.getLinkedAni().add(areaNetworkInfoEntity);
-// result.addAll(labelEntity.getLinkedAndi());
+ MgmtObjEntity mgmtObjEntity = DBServiceImpl.getInstance().getGson().fromJson(element.toJson(), MgmtObjEntity.class);
+ labelEntity.addMgmtObj(mgmtObjEntity);
break;
default:
break;
diff --git a/org.eclipse.om2m.persistence.service/src/main/java/org/eclipse/om2m/persistence/service/DAOFactory.java b/org.eclipse.om2m.persistence.service/src/main/java/org/eclipse/om2m/persistence/service/DAOFactory.java
index f6c1ded..eeaf8fe 100644
--- a/org.eclipse.om2m.persistence.service/src/main/java/org/eclipse/om2m/persistence/service/DAOFactory.java
+++ b/org.eclipse.om2m.persistence.service/src/main/java/org/eclipse/om2m/persistence/service/DAOFactory.java
@@ -23,15 +23,17 @@
import org.eclipse.om2m.commons.entities.AccessControlPolicyEntity;
import org.eclipse.om2m.commons.entities.AeAnncEntity;
import org.eclipse.om2m.commons.entities.AeEntity;
-import org.eclipse.om2m.commons.entities.CreatedAnnouncedResourceEntity;
-import org.eclipse.om2m.commons.entities.DynamicAuthorizationConsultationEntity;
-import org.eclipse.om2m.commons.entities.FlexContainerAnncEntity;
import org.eclipse.om2m.commons.entities.CSEBaseEntity;
import org.eclipse.om2m.commons.entities.ContainerEntity;
import org.eclipse.om2m.commons.entities.ContentInstanceEntity;
+import org.eclipse.om2m.commons.entities.CreatedAnnouncedResourceEntity;
+import org.eclipse.om2m.commons.entities.DynamicAuthorizationConsultationEntity;
+import org.eclipse.om2m.commons.entities.FlexContainerAnncEntity;
import org.eclipse.om2m.commons.entities.FlexContainerEntity;
import org.eclipse.om2m.commons.entities.GroupEntity;
import org.eclipse.om2m.commons.entities.LabelEntity;
+import org.eclipse.om2m.commons.entities.MgmtObjAnncEntity;
+import org.eclipse.om2m.commons.entities.MgmtObjEntity;
import org.eclipse.om2m.commons.entities.NodeEntity;
import org.eclipse.om2m.commons.entities.PollingChannelEntity;
import org.eclipse.om2m.commons.entities.RemoteCSEEntity;
@@ -58,6 +60,8 @@
public abstract DAO<FlexContainerEntity> getFlexContainerDAO();
+ public abstract DAO<MgmtObjEntity> getMgmtObjDAO();
+
public abstract DAO<ContentInstanceEntity> getContentInstanceDAO();
public abstract DAO<CSEBaseEntity> getCSEBaseDAO();
@@ -66,7 +70,7 @@
public abstract DAO<LabelEntity> getLabelDAO();
- public abstract DAO<NodeEntity> getNodeEntityDAO();
+ public abstract DAO<NodeEntity> getNodeDAO();
public abstract DAO<UriMapperEntity> getUriMapperEntity();
@@ -92,4 +96,6 @@
public abstract DAO<ContentInstanceEntity> getOldestDAO();
+ public abstract DAO<MgmtObjAnncEntity> getMgmtObjAnncDAO();
+
}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/util/FileUtil.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/util/FileUtil.java
index fbe2b93..242c0ce 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/util/FileUtil.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/util/FileUtil.java
@@ -11,21 +11,15 @@
import java.io.InputStreamReader;
import java.net.URL;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.eclipse.om2m.sdt.home.monitoring.servlet.HomeServlet;
import org.osgi.framework.BundleContext;
public class FileUtil {
- private static Log LOGGER = LogFactory.getLog(HomeServlet.class);
-
public static String getFileAsString(final String path,BundleContext context) {
String res = "";
if (context != null) {
URL url = context.getBundle().getResource(path);
- LOGGER.info("url ="+url);
BufferedReader br = null;
try {
br = new BufferedReader(new InputStreamReader(url.openConnection().getInputStream()));
@@ -33,7 +27,6 @@
res += br.readLine();
}
} catch (Exception e) {
- e.printStackTrace();
} finally {
try { br.close(); }
catch (Exception ignored) {}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/js/app.js b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/js/app.js
index 21dc8cd..3e93db9 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/js/app.js
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/js/app.js
@@ -9,25 +9,26 @@
var timerForNotifications = null;
$scope.imgModules = {
- 'temperature':'temp.jpg',
- 'noise':'noise.jpg',
- 'relativeHumidity':'humidity.png',
- 'atmosphericPressureSensor':'pressure.jpg',
- 'extendedCarbonDioxideSensor':'co2.png',
- 'contactSensor':'open_door_35.png',
- 'motionSensor':'motion_sensor.png',
- 'energyConsumption': 'power_consumption.png'
+ 'temperature':'temp.jpg',
+ 'noise':'noise.jpg',
+ 'relativeHumidity':'humidity.png',
+ 'atmosphericPressureSensor':'pressure.jpg',
+ 'extendedCarbonDioxideSensor':'co2.png',
+ 'contactSensor':'open_door_35.png',
+ 'motionSensor':'motion_sensor.png',
+ 'energyConsumption': 'power_consumption.png'
};
$scope.moduleFilterDefinition = {
- 'temperature':'curT0',
- 'noise':'noise',
- 'relativeHumidity':'relHy',
- 'atmosphericPressureSensor':'atmPe',
- 'extendedCarbonDioxideSensor':'cDeVe',
- 'contactSensor':'alarm',
- 'motionSensor':'alarm',
- 'energyConsumption':'power'
+ 'temperature':'curT0',
+ 'noise':'noise',
+ 'relativeHumidity':'relHy',
+ 'atmosphericPressureSensor':'atmPe',
+ 'extendedCarbonDioxideSensor':'cDeVe',
+ 'contactSensor':'alarm',
+ 'motionSensor':'alarm',
+ 'energyConsumption':'power',
+ 'numberValue': 'numVe'
};
$scope.datapointsNamePerModule = {
@@ -45,7 +46,8 @@
"energyConsumption" : ["volte", "currt", "power"],
"lock" : ["dooLk", "opeOy"],
"battery" : ["discg", "charg", "level", "capay"],
- "doorStatus": ["dooSt"]
+ "doorStatus": ["dooSt"],
+ "numberValue": ["numVe"]
};
$scope.devices = {};
@@ -69,9 +71,9 @@
$scope.load = function() {
var req = {
- method: 'GET',
- url: $scope.urlBase + '/Home_Monitoring_Application/in-cse/context',
- params: {sessionId: $scope.sessionId}
+ method: 'GET',
+ url: $scope.urlBase + '/Home_Monitoring_Application/in-cse/context',
+ params: {sessionId: $scope.sessionId}
};
$http(req).success(function (response, status, headers, config) {
$scope.cseContext = response;
@@ -88,19 +90,19 @@
// default polling interval in ms
var defaultModulePolling = 180000;
- // blacklist module polling interval in ms
- var blModules = ["runMode","streaming","colour","colourSaturation","faultDetection"];
-
- // fast polling interval in ms
- var fastModulePolling = 3000;
- var fastModules = ["binarySwitch","energyConsumption","lock"];
+// // blacklist module polling interval in ms
+// var blModules = ["runMode","streaming","colour","colourSaturation","faultDetection"];
+//
+// // fast polling interval in ms
+// var fastModulePolling = 3000;
+// var fastModules = ["binarySwitch","energyConsumption","lock"];
$scope.getDevicesAsArray = function() {
return Object.values($scope.devices);
};
$scope.getModulesFromDevice = function(device) {
- console.log("getModules called");
+ console.log("getModules for " + device.name);
return Object.values(device.modules);
};
@@ -109,10 +111,7 @@
};
$scope.switchFilter = function (module) {
- if (!((module.name === 'binarySwitch') || (module.name === 'lock'))) {
- return false;
- }
- return true;
+ return (module.name === 'binarySwitch') || (module.name === 'lock');
};
//filter to remove any device which contains a streaming module from the display device list
@@ -126,14 +125,14 @@
/*************************************************/
$scope.getDevices = function() {
var req = {
- method: 'GET',
- url: $scope.urlBase + '/' + $scope.cseContext
- + '?fu=1&drt=2&lbl=object.type/device',
- headers: {
- 'Content-Type': 'application/json',
- 'Accept': 'application/json',
- 'X-M2M-Origin': $scope.credentials
- }
+ method: 'GET',
+ url: $scope.urlBase + '/' + $scope.cseContext
+ + '?fu=1&drt=2&lbl=object.type/device',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'X-M2M-Origin': $scope.credentials
+ }
};
$http(req).success(function (response, status, headers, config) {
@@ -153,14 +152,14 @@
var deviceRi = newDevices[i];
var getDeviceReq = {
- method: 'GET',
- url: $scope.urlBase + '/~' + deviceRi + '?rcn=7',
- headers: {
- 'Content-Type': 'application/json',
- 'Accept': 'application/json',
- 'X-M2M-Origin': $scope.credentials
- },
- deviceRi: deviceRi // add device ri in request
+ method: 'GET',
+ url: $scope.urlBase + '/~' + deviceRi + '?rcn=7',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'X-M2M-Origin': $scope.credentials
+ },
+ deviceRi: deviceRi // add device ri in request
};
$http(getDeviceReq).success(function (response, status, headers, config) {
@@ -201,7 +200,6 @@
// add new device in devices list
$scope.devices[deviceRi] = device;
-
// get all the modules for the given device
$scope.getModules(device);
}).error(function (response, status, headers, config) {
@@ -221,15 +219,15 @@
$scope.getModules = function (device) {
var getModulesRiReq = {
- method: 'GET',
- url: $scope.urlBase + '/' + $scope.cseContext
- + '?fu=1&drt=2&lbl=object.type/module&lbl=device.id/' + device.id,
- headers: {
- 'Content-Type': 'application/json',
- 'Accept': 'application/json',
- 'X-M2M-Origin': $scope.credentials
- },
- device: device
+ method: 'GET',
+ url: $scope.urlBase + '/' + $scope.cseContext
+ + '?fu=1&drt=2&lbl=device.id/' + device.id,
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'X-M2M-Origin': $scope.credentials
+ },
+ device: device
};
$http(getModulesRiReq).success(function (response, status, headers, config) {
@@ -256,14 +254,14 @@
$scope.getModule = function (device, moduleRi) {
var getModuleReq = {
- method: 'GET',
- url: $scope.urlBase + '/~' + moduleRi + '?rcn=7',
- headers: {
- 'Content-Type': 'application/json',
- 'Accept': 'application/json',
- 'X-M2M-Origin':$scope.credentials
- },
- device: device
+ method: 'GET',
+ url: $scope.urlBase + '/~' + moduleRi + '?rcn=7',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'X-M2M-Origin':$scope.credentials
+ },
+ device: device
};
$http(getModuleReq).success(function (response, status, headers, config) {
@@ -283,7 +281,7 @@
module.id = id;
module.ri = root.ri;
module.name = moduleName;
- module.img = 'images/'+$scope.getImageModule(moduleName);
+ module.img = 'images/' + $scope.getImageModule(moduleName);
// fill the class with the module name to define the text color. see css file.
module.colorClass = tab[tab.length -1];
@@ -295,8 +293,6 @@
module.isReadOnly = false;
}
-
-
// create the attributes
var dpNames = $scope.datapointsNamePerModule[module.name];
if (dpNames) {
@@ -307,14 +303,11 @@
);
}
-
var propName = $scope.getPropValueModule(moduleName);
if (propName) {
module.value = module.datapoints[propName].value;
}
-
-
if (module.name === 'streaming') {
var index = $scope.getCamModuleIndex(module.id);
if (index == -1) {
@@ -344,15 +337,15 @@
$scope.createSubscription = function(toBeSubscribedResource) {
req = {
- method : 'POST',
- url : $scope.urlBase + '/Home_Monitoring_Application/in-cse/context',
- data : {
- resourceId:toBeSubscribedResource,
- sessionId: $scope.sessionId
- },
- headers : {
- 'Content-Type' : 'application/json'
- }
+ method : 'POST',
+ url : $scope.urlBase + '/Home_Monitoring_Application/in-cse/context',
+ data : {
+ resourceId:toBeSubscribedResource,
+ sessionId: $scope.sessionId
+ },
+ headers : {
+ 'Content-Type' : 'application/json'
+ }
};
// don't care about response
$http(req);
@@ -361,104 +354,94 @@
$scope.getNotifications = function() {
req = {
- method : 'GET',
- url : $scope.urlBase + '/Home_Monitoring_Application/in-cse/context/notifications',
- params: {sessionId: $scope.sessionId},
- headers : {
- 'Accept' : 'application/json'
- }
+ method : 'GET',
+ url : $scope.urlBase + '/Home_Monitoring_Application/in-cse/context/notifications',
+ params: {sessionId: $scope.sessionId},
+ headers : {
+ 'Accept' : 'application/json'
+ }
};
$http(req).success(
- function(response, status, headers, config) {
- // for each notification --> update device & module model
- var notifications = response;
- // notifications is an array
- notifications.forEach(
- function(notification) {
- console.log(notification);
- var sgn = notification["m2m:sgn"];
- var nev = null;
- if (sgn !== null) {
- nev = sgn["m2m:nev"];
- }
- var rep = null;
- if (nev != null) {
- rep = nev["m2m:rep"];
- }
-
- var moduleRep = null;
- if (rep != null) {
- var key = $scope.getRootKey(rep);
- moduleRep = rep[key];
- }
-
- if (moduleRep != null) {
- var internalModule = $scope.getModuleByRi(moduleRep.ri, moduleRep.pi);
- console.log(internalModule);
-
-
- var propValueModule = $scope.getPropValueModule(internalModule.name);
- if (propValueModule) {
- var value = moduleRep[propValueModule];
- if (internalModule.value) {
- internalModule.value = value;
- }
- }
-
- if (moduleRep.powSe) {
- console.log('powSe value:' + moduleRep.powSe);
- var datapoints = internalModule.datapoints;
- var powSeValue = (moduleRep.powSe === 'true');
- datapoints.powSe.value = powSeValue;
- if (internalModule.state != powSeValue) {
- internalModule.state = powSeValue;
- }
-
- console.log('powSe updated!!!!!!!!!!!!!!!!!');
- }
-
- if (moduleRep.dooLk) {
- console.log('dooLk value:' + moduleRep.dooLk);
- var datapoints = internalModule.datapoints;
- var dooLkValue = (moduleRep.dooLk ==='true');
- datapoints.dooLk.value = dooLkValue;
- if (internalModule.state != dooLkValue) {
- internalModule.state = dooLkValue;
- }
- }
-
- // put background red
- // here we need to be carefull with device = moduleRep.pi
- // as we have announced device.
- device = $scope.getDeviceByRi(moduleRep.pi);
- if (device) {
-
-
- $scope.removeColor(device);
-
- }
-
-
+ function(response, status, headers, config) {
+ // for each notification --> update device & module model
+ var notifications = response;
+ // notifications is an array
+ notifications.forEach(
+ function(notification) {
+ console.log(notification);
+ var sgn = notification["m2m:sgn"];
+ var nev = null;
+ if (sgn !== null) {
+ nev = sgn["m2m:nev"];
+ }
+ var rep = null;
+ if (nev != null) {
+ rep = nev["m2m:rep"];
+ }
+
+ var moduleRep = null;
+ if (rep != null) {
+ var key = $scope.getRootKey(rep);
+ moduleRep = rep[key];
+ }
+
+ if (moduleRep != null) {
+ var internalModule = $scope.getModuleByRi(moduleRep.ri, moduleRep.pi);
+ console.log(internalModule);
+
+ var propValueModule = $scope.getPropValueModule(internalModule.name);
+ if (propValueModule) {
+ var value = moduleRep[propValueModule];
+ if (internalModule.value) {
+ internalModule.value = value;
}
}
- );
- }
+
+ if (moduleRep.powSe) {
+ console.log('powSe value:' + moduleRep.powSe);
+ var datapoints = internalModule.datapoints;
+ var powSeValue = (moduleRep.powSe === 'true');
+ datapoints.powSe.value = powSeValue;
+ if (internalModule.state != powSeValue) {
+ internalModule.state = powSeValue;
+ }
+ console.log('powSe updated!!!!!!!!!!!!!!!!!');
+ }
+
+ if (moduleRep.dooLk) {
+ console.log('dooLk value:' + moduleRep.dooLk);
+ var datapoints = internalModule.datapoints;
+ var dooLkValue = (moduleRep.dooLk ==='true');
+ datapoints.dooLk.value = dooLkValue;
+ if (internalModule.state != dooLkValue) {
+ internalModule.state = dooLkValue;
+ }
+ }
+
+ // put background red
+ // here we need to be carefull with device = moduleRep.pi
+ // as we have announced device.
+ device = $scope.getDeviceByRi(moduleRep.pi);
+ if (device) {
+ $scope.removeColor(device);
+ }
+ }
+ }
+ );
+ }
);
}
$scope.removeColor = function(d) {
-
- d.isUpdated=true;
+ d.isUpdated = true;
// remove background after 1,5s
-
$timeout(
function() {
d.isUpdated = false;
},
1500
);
-
}
// called when the user clicks on the witch widget in the HMI
@@ -474,66 +457,67 @@
var lk = switchModule.state;
// switch on/off
req = {
- method : 'PUT',
- url : switchModule.url,
- data : '{\"hd:lock\": {\"dooLk\": \"' + lk + '\"}}',
- headers : {
- 'Content-Type' : 'application/json',
- 'X-M2M-Origin' : $scope.credentials
- },
- valueToBeSet: lk,
- currentSwitch: switchModule
+ method : 'PUT',
+ url : switchModule.url,
+ data : '{\"hd:lock\": {\"dooLk\": \"' + lk + '\"}}',
+ headers : {
+ 'Content-Type' : 'application/json',
+ 'X-M2M-Origin' : $scope.credentials
+ },
+ valueToBeSet: lk,
+ currentSwitch: switchModule
};
$http(req).success(function(response, status, headers, config) {
- console.log("binary lock state changed");
-
- // config = switchModule
- config.currentSwitch.hideSpinning = true;
- if (config.currentSwitch.state !== config.valueToBeSet) {
- config.currentSwitch.state = config.valueToBeSet;
- }
-
- var datapoints = config.currentSwitch.datapoints;
- datapoints.dooLk.value = config.valueToBeSet;
- console.log("door lock state changed");
-
- }).error(function(response, status, headers, config) {
- console.log("error on lock state change action");
- config.currentSwitch.hideSpinning = true;
- config.currentSwitch.state = !config.valueToBeSet;
-
- });
+ console.log("binary lock state changed");
+
+ // config = switchModule
+ config.currentSwitch.hideSpinning = true;
+ if (config.currentSwitch.state !== config.valueToBeSet) {
+ config.currentSwitch.state = config.valueToBeSet;
+ }
+
+ var datapoints = config.currentSwitch.datapoints;
+ datapoints.dooLk.value = config.valueToBeSet;
+ console.log("door lock state changed");
+
+ }).error(function(response, status, headers, config) {
+ console.log("error on lock state change action");
+ config.currentSwitch.hideSpinning = true;
+ config.currentSwitch.state = !config.valueToBeSet;
+
+ });
}
} else if (switchModule.name === 'binarySwitch') {
switchModule.newState = switchModule.state;
req = {
- method : 'PUT',
- url : switchModule.url,
- data : '{\"hd:binSh\": {\"powSe\": \"' + switchModule.state + '\"}}',
- headers : {
- 'Content-Type' : 'application/json',
- 'X-M2M-Origin' : $scope.credentials
- },
- valueToBeSet : switchModule.state,
- currentSwitch : switchModule
-
+ method : 'PUT',
+ url : switchModule.url,
+ data : '{\"hd:binSh\": {\"powSe\": \"' + switchModule.state + '\"}}',
+ headers : {
+ 'Content-Type' : 'application/json',
+ 'X-M2M-Origin' : $scope.credentials
+ },
+ valueToBeSet : switchModule.state,
+ currentSwitch : switchModule
};
$http(req).success(
- function(response, status, headers, config) {
- // binarySwitchModule.state = !binarySwitchModule.state;
- config.currentSwitch.hideSpinning = true;
- if (config.currentSwitch.state !== config.valueToBeSet) {
- config.currentSwitch.state = config.valueToBeSet;
- }
-
- var datapoints = config.currentSwitch.datapoints;
- datapoints.powSe.value = config.valueToBeSet;
- console.log("binary switch state changed");
- }).error(function(response, status, headers, config) {
- config.currentSwitch.hideSpinning = true;
- config.currentSwitch.state = !config.valueToBeSet;
- console.log("error on binary switch state change action");
- });
+ function(response, status, headers, config) {
+ // binarySwitchModule.state = !binarySwitchModule.state;
+ config.currentSwitch.hideSpinning = true;
+ if (config.currentSwitch.state !== config.valueToBeSet) {
+ config.currentSwitch.state = config.valueToBeSet;
+ }
+
+ var datapoints = config.currentSwitch.datapoints;
+ datapoints.powSe.value = config.valueToBeSet;
+ console.log("binary switch state changed");
+ })
+ .error(function(response, status, headers, config) {
+ config.currentSwitch.hideSpinning = true;
+ config.currentSwitch.state = !config.valueToBeSet;
+ console.log("error on binary switch state change action");
+ }
+ );
}
}
@@ -782,12 +766,12 @@
var init = function () {
var req = {
- method: 'GET',
- url: '../security/cred',
- params : {sessionId: $scope.sessionId},
- headers: {
- 'Content-Type': 'application/json'
- }
+ method: 'GET',
+ url: '../security/cred',
+ params : {sessionId: $scope.sessionId},
+ headers: {
+ 'Content-Type': 'application/json'
+ }
};
$http(req).success(function (response, status, headers, config) {
$scope.credentials = response.credentials;
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/DeviceType.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/DeviceType.java
index c01c6c0..5b2e53f 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/DeviceType.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/DeviceType.java
@@ -29,7 +29,7 @@
deviceDoor(100, "deviceDoor", "deviceDoor", "devDr"),
deviceSmokeExtractor(101, "deviceSmokeExtractor", "deviceSmokeExtractor", "dSeEr"),
- deviceSwitchButton(102, "deviceSwitchButton", "deviceSwitchButton", "dShBn"),
+ deviceSwitchButton(102, "deviceSwitchButton", "deviceSwitchButton", "deSBn"),
deviceWarningDevice(103, "deviceWarningDevice", "deviceWarningDevice", "deWDe"),
deviceGasValve(200, "deviceGasValve", "deviceGasValve", "dGsVe"),