Skip to content
This repository was archived by the owner on Sep 1, 2024. It is now read-only.

Commit b32fb55

Browse files
committed
Added descriptor classes for processing data definition
1 parent ec75653 commit b32fb55

23 files changed

Lines changed: 611 additions & 52 deletions

File tree

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/*
2+
* Copyright (c) 2020 Dario Lucia (https://www.dariolucia.eu)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package eu.dariolucia.reatmetric.api.activity;
18+
19+
import eu.dariolucia.reatmetric.api.value.ValueTypeEnum;
20+
21+
public class ActivityArgumentDescriptor {
22+
23+
private final String name;
24+
private final String description;
25+
private final ValueTypeEnum rawDataType;
26+
private final ValueTypeEnum engineeringDataType;
27+
private final String unit;
28+
private final boolean fixed;
29+
private final boolean defaultValuePresent;
30+
private final Object engineeringDefaultValue;
31+
private final Object rawDefaultValue;
32+
private final boolean decalibrationSet;
33+
private final boolean checkSet;
34+
35+
public ActivityArgumentDescriptor(String name, String description, ValueTypeEnum rawDataType, ValueTypeEnum engineeringDataType, String unit, boolean fixed, boolean defaultValuePresent, Object engineeringDefaultValue, Object rawDefaultValue, boolean decalibrationSet, boolean checkSet) {
36+
this.name = name;
37+
this.description = description;
38+
this.rawDataType = rawDataType;
39+
this.engineeringDataType = engineeringDataType;
40+
this.unit = unit;
41+
this.fixed = fixed;
42+
this.defaultValuePresent = defaultValuePresent;
43+
this.engineeringDefaultValue = engineeringDefaultValue;
44+
this.rawDefaultValue = rawDefaultValue;
45+
this.decalibrationSet = decalibrationSet;
46+
this.checkSet = checkSet;
47+
}
48+
49+
public String getName() {
50+
return name;
51+
}
52+
53+
public String getDescription() {
54+
return description;
55+
}
56+
57+
public ValueTypeEnum getRawDataType() {
58+
return rawDataType;
59+
}
60+
61+
public ValueTypeEnum getEngineeringDataType() {
62+
return engineeringDataType;
63+
}
64+
65+
public String getUnit() {
66+
return unit;
67+
}
68+
69+
public boolean isFixed() {
70+
return fixed;
71+
}
72+
73+
public boolean isDefaultValuePresent() {
74+
return defaultValuePresent;
75+
}
76+
77+
public Object getEngineeringDefaultValue() {
78+
return engineeringDefaultValue;
79+
}
80+
81+
public Object getRawDefaultValue() {
82+
return rawDefaultValue;
83+
}
84+
85+
public boolean isDecalibrationSet() {
86+
return decalibrationSet;
87+
}
88+
89+
public boolean isCheckSet() {
90+
return checkSet;
91+
}
92+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* Copyright (c) 2020 Dario Lucia (https://www.dariolucia.eu)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package eu.dariolucia.reatmetric.api.activity;
18+
19+
import eu.dariolucia.reatmetric.api.common.AbstractSystemEntityDescriptor;
20+
import eu.dariolucia.reatmetric.api.common.Pair;
21+
import eu.dariolucia.reatmetric.api.model.SystemEntityPath;
22+
import eu.dariolucia.reatmetric.api.model.SystemEntityType;
23+
24+
import java.util.List;
25+
26+
public class ActivityDescriptor extends AbstractSystemEntityDescriptor {
27+
28+
private final String description;
29+
private final String defaultRoute;
30+
private final String activityType;
31+
private final List<ActivityArgumentDescriptor> argumentDescriptors;
32+
private final List<Pair<String, String>> properties;
33+
34+
public ActivityDescriptor(SystemEntityPath path, int externalId, String description, String defaultRoute, String activityType, List<ActivityArgumentDescriptor> argumentDescriptors, List<Pair<String, String>> properties) {
35+
super(path, externalId, SystemEntityType.ACTIVITY);
36+
this.description = description;
37+
this.defaultRoute = defaultRoute;
38+
this.activityType = activityType;
39+
this.argumentDescriptors = List.copyOf(argumentDescriptors);
40+
this.properties = List.copyOf(properties);
41+
}
42+
43+
public String getDescription() {
44+
return description;
45+
}
46+
47+
public String getDefaultRoute() {
48+
return defaultRoute;
49+
}
50+
51+
public String getActivityType() {
52+
return activityType;
53+
}
54+
55+
public List<ActivityArgumentDescriptor> getArgumentDescriptors() {
56+
return argumentDescriptors;
57+
}
58+
59+
public List<Pair<String, String>> getProperties() {
60+
return properties;
61+
}
62+
}

eu.dariolucia.reatmetric.api/src/main/java/eu/dariolucia/reatmetric/api/activity/IActivityOccurrenceDataProvisionService.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,15 @@
1818
package eu.dariolucia.reatmetric.api.activity;
1919

2020
import eu.dariolucia.reatmetric.api.common.IDataItemStateProvisionService;
21+
import eu.dariolucia.reatmetric.api.common.exceptions.ReatmetricException;
22+
import eu.dariolucia.reatmetric.api.model.SystemEntityPath;
2123

2224
/**
2325
* This interface is a specialisation of the {@link IDataItemStateProvisionService}, for activity occurrences.
2426
*/
2527
public interface IActivityOccurrenceDataProvisionService extends IDataItemStateProvisionService<IActivityOccurrenceDataSubscriber, ActivityOccurrenceDataFilter, ActivityOccurrenceData> {
26-
28+
29+
ActivityDescriptor getDescriptor(SystemEntityPath path) throws ReatmetricException;
30+
31+
ActivityDescriptor getDescriptor(int externalId) throws ReatmetricException;
2732
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Copyright (c) 2020 Dario Lucia (https://www.dariolucia.eu)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package eu.dariolucia.reatmetric.api.common;
18+
19+
import eu.dariolucia.reatmetric.api.model.SystemEntityPath;
20+
import eu.dariolucia.reatmetric.api.model.SystemEntityType;
21+
22+
import java.io.Serializable;
23+
24+
/**
25+
* Objects of this class are descriptions of the specific system entity they refer to.
26+
*/
27+
public abstract class AbstractSystemEntityDescriptor implements Serializable {
28+
29+
/**
30+
*
31+
*/
32+
private static final long serialVersionUID = 1L;
33+
34+
private final SystemEntityPath path;
35+
private final int externalId;
36+
private final SystemEntityType type;
37+
38+
protected AbstractSystemEntityDescriptor(SystemEntityPath path, int externalId, SystemEntityType type) {
39+
this.path = path;
40+
this.externalId = externalId;
41+
this.type = type;
42+
}
43+
44+
public SystemEntityPath getPath() {
45+
return path;
46+
}
47+
48+
public int getExternalId() {
49+
return externalId;
50+
}
51+
52+
public SystemEntityType getType() {
53+
return type;
54+
}
55+
56+
@Override
57+
public String toString() {
58+
return "{" +
59+
"externalId=" + getExternalId() +
60+
", path=" + getPath() +
61+
", type=" + getType() +
62+
"}";
63+
}
64+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Copyright (c) 2020 Dario Lucia (https://www.dariolucia.eu)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package eu.dariolucia.reatmetric.api.events;
18+
19+
import eu.dariolucia.reatmetric.api.common.AbstractSystemEntityDescriptor;
20+
import eu.dariolucia.reatmetric.api.messages.Severity;
21+
import eu.dariolucia.reatmetric.api.model.SystemEntityPath;
22+
import eu.dariolucia.reatmetric.api.model.SystemEntityType;
23+
24+
public class EventDescriptor extends AbstractSystemEntityDescriptor {
25+
26+
private final String description;
27+
private final Severity severity;
28+
private final String eventType;
29+
private final boolean conditionDriven;
30+
31+
public EventDescriptor(SystemEntityPath path, int externalId, String description, Severity severity, String eventType, boolean conditionDriven) {
32+
super(path, externalId, SystemEntityType.EVENT);
33+
this.description = description;
34+
this.severity = severity;
35+
this.eventType = eventType;
36+
this.conditionDriven = conditionDriven;
37+
}
38+
39+
public String getDescription() {
40+
return description;
41+
}
42+
43+
public Severity getSeverity() {
44+
return severity;
45+
}
46+
47+
public String getEventType() {
48+
return eventType;
49+
}
50+
51+
public boolean isConditionDriven() {
52+
return conditionDriven;
53+
}
54+
55+
}

eu.dariolucia.reatmetric.api/src/main/java/eu/dariolucia/reatmetric/api/events/IEventDataProvisionService.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,16 @@
1818
package eu.dariolucia.reatmetric.api.events;
1919

2020
import eu.dariolucia.reatmetric.api.common.IDataItemProvisionService;
21+
import eu.dariolucia.reatmetric.api.common.exceptions.ReatmetricException;
22+
import eu.dariolucia.reatmetric.api.model.SystemEntityPath;
2123

2224
/**
2325
*
2426
* @author dario
2527
*/
2628
public interface IEventDataProvisionService extends IDataItemProvisionService<IEventDataSubscriber, EventDataFilter, EventData> {
2729

30+
EventDescriptor getDescriptor(SystemEntityPath path) throws ReatmetricException;
31+
32+
EventDescriptor getDescriptor(int externalId) throws ReatmetricException;
2833
}

eu.dariolucia.reatmetric.api/src/main/java/eu/dariolucia/reatmetric/api/model/ISystemModelProvisionService.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package eu.dariolucia.reatmetric.api.model;
1919

20+
import eu.dariolucia.reatmetric.api.common.AbstractSystemEntityDescriptor;
2021
import eu.dariolucia.reatmetric.api.common.exceptions.ReatmetricException;
2122
import eu.dariolucia.reatmetric.api.processing.exceptions.ProcessingModelException;
2223

@@ -47,4 +48,9 @@ public interface ISystemModelProvisionService {
4748
void enable(SystemEntityPath path) throws ReatmetricException;
4849

4950
void disable(SystemEntityPath path) throws ReatmetricException;
51+
52+
AbstractSystemEntityDescriptor getDescriptorOf(int id) throws ReatmetricException;
53+
54+
AbstractSystemEntityDescriptor getDescriptorOf(SystemEntityPath path) throws ReatmetricException;
55+
5056
}

eu.dariolucia.reatmetric.api/src/main/java/eu/dariolucia/reatmetric/api/model/SystemEntityPath.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public final class SystemEntityPath implements Comparable<SystemEntityPath>, Ser
3030
/**
3131
*
3232
*/
33-
private static final long serialVersionUID = 8858858517842953497L;
33+
private static final long serialVersionUID = 1L;
3434

3535
public static SystemEntityPath fromString(String systemEntity) {
3636
String[] parts = systemEntity.split("\\.", -1);

eu.dariolucia.reatmetric.api/src/main/java/eu/dariolucia/reatmetric/api/parameters/IParameterDataProvisionService.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,16 @@
1818
package eu.dariolucia.reatmetric.api.parameters;
1919

2020
import eu.dariolucia.reatmetric.api.common.IDataItemStateProvisionService;
21+
import eu.dariolucia.reatmetric.api.common.exceptions.ReatmetricException;
22+
import eu.dariolucia.reatmetric.api.model.SystemEntityPath;
2123

2224
/**
2325
*
2426
* @author dario
2527
*/
2628
public interface IParameterDataProvisionService extends IDataItemStateProvisionService<IParameterDataSubscriber, ParameterDataFilter, ParameterData> {
27-
29+
30+
ParameterDescriptor getDescriptor(SystemEntityPath path) throws ReatmetricException;
31+
32+
ParameterDescriptor getDescriptor(int externalId) throws ReatmetricException;
2833
}

0 commit comments

Comments
 (0)