forked from eclipse/org.eclipse.sensinact.gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sensinact.ecore
101 lines (101 loc) · 8.86 KB
/
sensinact.ecore
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="provider" nsURI="https://eclipse.org/sensinact/core/provider/1.0"
nsPrefix="sensinactProvider">
<eAnnotations source="http://www.eclipse.org/OCL/Import">
<details key="ecore" value="http://www.eclipse.org/emf/2002/Ecore"/>
</eAnnotations>
<eClassifiers xsi:type="ecore:EClass" name="Provider">
<eOperations name="getService" eType="#//Service">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="EStructuralFeature serviceFeature = eClass().getEStructuralFeature(serviceName);
if (serviceFeature instanceof <%org.eclipse.emf.ecore.EReference%>) {
	EClass refEClass = ((EReference) serviceFeature).getEReferenceType();
	return ProviderPackage.Literals.SERVICE.isSuperTypeOf(refEClass) ? (Service) eGet(serviceFeature) : null;
}
return null;"/>
</eAnnotations>
<eParameters name="serviceName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="getServiceEClass" eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EClass">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="<%org.eclipse.emf.ecore.EStructuralFeature%> serviceFeature = eClass().getEStructuralFeature(serviceName);
if (serviceFeature instanceof <%org.eclipse.emf.ecore.EReference%>) {
	<%org.eclipse.emf.ecore.EClass%> refEClass = ((EReference) serviceFeature).getEReferenceType();
	return ProviderPackage.Literals.SERVICE.isSuperTypeOf(refEClass) ? refEClass : null;
}
return null;"/>
</eAnnotations>
<eParameters name="serviceName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="id" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
unsettable="true" iD="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="admin" eType="#//Admin"
unsettable="true" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="linkedProviders" upperBound="-1"
eType="#//Provider" unsettable="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EDataType" name="EGeoJsonObject" instanceClassName="org.eclipse.sensinact.gateway.geojson.GeoJsonObject"/>
<eClassifiers xsi:type="ecore:EClass" name="Admin" eSuperTypes="#//Service">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="friendlyName" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" unsettable="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="location" eType="#//EGeoJsonObject"
unsettable="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="modelPackageUri" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" unsettable="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="model" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
unsettable="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Service">
<eOperations name="eIsSet" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
<eParameters name="feature" eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EStructuralFeature"/>
</eOperations>
<eStructuralFeatures xsi:type="ecore:EReference" name="metadata" upperBound="-1"
eType="#//FeatureMetadata" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Metadata">
<eStructuralFeatures xsi:type="ecore:EReference" name="extra" upperBound="-1"
eType="#//FeatureCustomMetadata" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="timestamp" eType="#//EInstant"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="FeatureMetadata" instanceClassName="java.util.Map$Entry">
<eStructuralFeatures xsi:type="ecore:EReference" name="key" eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="value" eType="#//Metadata"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EDataType" name="EInstant" instanceClassName="java.time.Instant"/>
<eClassifiers xsi:type="ecore:EClass" name="FeatureCustomMetadata">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="timestamp" eType="#//EInstant"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="ResourceType">
<eLiterals name="ACTION"/>
<eLiterals name="PROPERTY" value="1"/>
<eLiterals name="SENSOR" value="2"/>
<eLiterals name="STATE_VARIABLE" value="3"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="ValueType">
<eLiterals name="FIXED"/>
<eLiterals name="OBSERVABLE" value="1"/>
<eLiterals name="MODIFIABLE" value="2"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ServiceMap" instanceClassName="java.util.Map$Entry">
<eStructuralFeatures xsi:type="ecore:EReference" name="value" eType="#//Service"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="key" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="DynamicProvider" eSuperTypes="#//Provider">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="To achieve a good Model, concrete EClasses that inherit from Provider should 
use References for predefined Services.
Sometimes however you can't know how many Services a Provider can have. 
In such a case, this Map can be used in addtion to directly Referenced Services.

As an example: Such a Provider can be a Camera that can detect Objects like cars, 
bikes or pedestriance in configureable zones. Each zone can in this case be a 
Service with defined Resources. How may zones exist however, depdends on the 
configuration. Thus our camera model can benefit from service map in addition
some predefined fix services it might have.

Service names must still be unique and must not collide with existing References.
"/>
</eAnnotations>
<eOperations name="getService" eType="#//Service">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="Service service = super.getService(serviceName);
return service != null ? service : getServices().get(serviceName);"/>
</eAnnotations>
<eParameters name="serviceName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="getServiceEClass" eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EClass">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="EClass serviceType = super.getServiceEClass(serviceName);
if (serviceType != null) {
 return serviceType;
} else {
 Service service = getServices().get(serviceName);
 return service != null ? service.eClass() : null;
}"/>
</eAnnotations>
<eParameters name="serviceName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eStructuralFeatures xsi:type="ecore:EReference" name="services" upperBound="-1"
eType="#//ServiceMap" containment="true">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="To achieve a good Model, concrete EClasses that inherit from Provider should 
use References for predefined Services.
Sometimes however you can't know how many Services a Provider can have. 
In such a case, this Map can be used in addtion to directly Referenced Services.

As an example: Such a Provider can be a Camera that can detect Objects like cars, 
bikes or pedestriance in configureable zones. Each zone can in this case be a 
Service with defined Resources. How may zones exist however, depdends on the 
configuration. Thus our camera model can benefit from service map in addition
some predefined fix services it might have.

Service names must still be unique and must not collide with existing References.
"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
</ecore:EPackage>