Skip to content

Commit

Permalink
#164 further UI groups, larger group indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
eichelbe committed Jan 11, 2024
1 parent 5f8a705 commit 45bde27
Show file tree
Hide file tree
Showing 3 changed files with 147 additions and 105 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,41 +207,41 @@ project Connectors {

// IIP-Ecosphere provided connectors
compound Connector refines Service {
setOf(AssignmentOperation) operations = {};
TextEncoding encoding = TextEncoding::ASCII;
assign (uiGroup = UiInvisibleGroup) to {
setOf(MappingEntry) mapping = {};
}

String class;
String artifact;
String inAdapterClass = ""; // if given, use adapter; may be "*" to use generated transport serializer
String outAdapterClass = ""; // if given, use adapter; may be "*" to use generated transport serializer
// may collapse into one, to be supported by configurable mapping
IOTypeWithPath inInterface; // provided data input to be mapped into adapter, alternative to adapterClass
IOTypeWithPath outInterface; // provided data output to be mapped into adapter, alternative to adapterClass
setOf(ConnectorInputHandler) inputHandlers = {};
Constraint inputHandlersOk = inputHandlers->forAll(h|handlerOk(h, self));

NonEmptyString host = "localhost";
Port port;
Integer samplingPeriod = 0; // no sampling by default
SecuritySettings security = null;
Boolean mock = false; // in-vivo testing, enable a mocking connector service wrapper
CacheMode cacheMode = CacheMode::NONE;
String deviceServiceKey;
ServiceKind kind = ServiceKind.SOURCE_SERVICE;
Parameters parameter = {
StringParameter {
name="outPath", // default parameter, changes machine output data path
defaultValue="" // interpreted by ConnectorServiceWrapper as not set
}, StringParameter {
name="inPath", // default parameter, changes machine input data path
defaultValue="" // interpreted by ConnectorServiceWrapper as not set
}
};


assign (uiGroup = UiOptionalGroup1) to {
setOf(AssignmentOperation) operations = {};
TextEncoding encoding = TextEncoding::ASCII;
String inAdapterClass = ""; // if given, use adapter; may be "*" to use generated transport serializer
String outAdapterClass = ""; // if given, use adapter; may be "*" to use generated transport serializer
setOf(ConnectorInputHandler) inputHandlers = {};
CacheMode cacheMode = CacheMode::NONE;
ServiceKind kind = ServiceKind.SOURCE_SERVICE;
Parameters parameter = {
StringParameter {
name="outPath", // default parameter, changes machine output data path
defaultValue="" // interpreted by ConnectorServiceWrapper as not set
}, StringParameter {
name="inPath", // default parameter, changes machine input data path
defaultValue="" // interpreted by ConnectorServiceWrapper as not set
}
};
}
Constraint inputHandlersOk = inputHandlers->forAll(h|handlerOk(h, self));
assign (uiGroup = UiOptionalGroup2) to {
Boolean mock = false; // in-vivo testing, enable a mocking connector service wrapper
String deviceServiceKey;
}
assign (uiGroup = UiInvisibleGroup) to {
setOf(MappingEntry) mapping = {};
}
Constraint connectorOutputSize = fwdTypes(output).size() < 2;
Constraint connectorInputSize = fwdTypes(input).size() < 2;
Constraint connectorKind = kind == ServiceKind.SOURCE_SERVICE or kind == ServiceKind.SINK_SERVICE;
Expand All @@ -251,72 +251,100 @@ project Connectors {
}

compound ChannelConnector refines Connector {
String inSerializerClass = ""; // if not given, use registry
String outSerializerClass = ""; // if not given, use registry
String inChannel = "";
String outChannel = "";
setOf(String) outChannels; // additional out channels towards platform, unified with outChannel; may also be used instead of outChannel
MachineFormatter machineFormatter = null;
MachineParser machineParser = null;
assign (uiGroup = UiOptionalGroup1) to {
setOf(String) outChannels; // additional out channels towards platform, unified with outChannel; may also be used instead of outChannel
String inSerializerClass = ""; // if not given, use registry
String outSerializerClass = ""; // if not given, use registry
}

Constraint noModelCallOperation = collectOperations(operations)->selectByKind(ModelCallOperation).isEmpty();
}

compound OpcUaV1Connector refines Connector { // fixed template types see JavaConnector.vtl
String class = "de.iip_ecosphere.platform.connectors.opcuav1.OpcUaConnector";
String artifact ="de.iip-ecosphere.platform:connectors.opcuav1:";
Port port = 4840;
String deviceServiceKey = "opcua";
NameplateInfo nameplateInfo = {
manufacturerProductDesignation = "Generic OPC UA connector@en",
manufacturer = refBy(manufacturer_sse)
};
assign (uiGroup = UiInvisibleGroup) to {
String class = "de.iip_ecosphere.platform.connectors.opcuav1.OpcUaConnector";
String artifact ="de.iip-ecosphere.platform:connectors.opcuav1:";
NameplateInfo nameplateInfo = {
manufacturerProductDesignation = "Generic OPC UA connector@en",
manufacturer = refBy(manufacturer_sse)
};
}
assign (uiGroup = UiOptionalGroup1) to {
Port port = 4840;
}
assign (uiGroup = UiOptionalGroup2) to {
String deviceServiceKey = "opcua";
}
}

compound AasConnector refines Connector { // fixed template types see JavaConnector.vtl
String class = "de.iip_ecosphere.platform.connectors.aas.AasConnector";
String artifact ="de.iip-ecosphere.platform:connectors.aas:";
assign (uiGroup = UiInvisibleGroup) to {
String class = "de.iip_ecosphere.platform.connectors.aas.AasConnector";
String artifact ="de.iip-ecosphere.platform:connectors.aas:";
NameplateInfo nameplateInfo = {
manufacturerProductDesignation = "Generic AAS connector@en",
manufacturer = refBy(manufacturer_sse)
};
}
NonEmptyString idShortSpec; // name or java regex pattern, shall start with iri:urn:...
NonEmptyString registryHost = "localhost";
Port registryPort;
String registryPath;
NameplateInfo nameplateInfo = {
manufacturerProductDesignation = "Generic AAS connector@en",
manufacturer = refBy(manufacturer_sse)
};
}

compound MqttV3Connector refines ChannelConnector { // fixed template types see JavaConnector.vtl
String class = "de.iip_ecosphere.platform.connectors.mqttv3.PahoMqttv3Connector";
String artifact ="de.iip-ecosphere.platform:connectors.mqttv3:";
Port port = 1883;
String deviceServiceKey = "mqttv3";
NameplateInfo nameplateInfo = {
manufacturerProductDesignation = "Generic MQTT v3 connector@en",
manufacturer = refBy(manufacturer_sse)
};
assign (uiGroup = UiInvisibleGroup) to {
String class = "de.iip_ecosphere.platform.connectors.mqttv3.PahoMqttv3Connector";
String artifact ="de.iip-ecosphere.platform:connectors.mqttv3:";
NameplateInfo nameplateInfo = {
manufacturerProductDesignation = "Generic MQTT v3 connector@en",
manufacturer = refBy(manufacturer_sse)
};
}
assign (uiGroup = UiOptionalGroup1) to {
Port port = 1883;
}
assign (uiGroup = UiOptionalGroup2) to {
String deviceServiceKey = "mqttv3";
}
}

compound MqttV5Connector refines ChannelConnector { // fixed template types see JavaConnector.vtl
String class = "de.iip_ecosphere.platform.connectors.mqttv5.PahoMqttv5Connector";
String artifact ="de.iip-ecosphere.platform:connectors.mqttv5:";
Port port = 1883;
String deviceServiceKey = "mqttv5";
NameplateInfo nameplateInfo = {
manufacturerProductDesignation = "Generic MQTT v5 connector@en",
manufacturer = refBy(manufacturer_sse)
};
assign (uiGroup = UiInvisibleGroup) to {
String class = "de.iip_ecosphere.platform.connectors.mqttv5.PahoMqttv5Connector";
String artifact ="de.iip-ecosphere.platform:connectors.mqttv5:";
NameplateInfo nameplateInfo = {
manufacturerProductDesignation = "Generic MQTT v5 connector@en",
manufacturer = refBy(manufacturer_sse)
};
}
assign (uiGroup = UiOptionalGroup1) to {
Port port = 1883;
}
assign (uiGroup = UiOptionalGroup2) to {
String deviceServiceKey = "mqttv5";
}
}

compound MqttConnector refines ChannelConnector { // fixed template types see JavaConnector.vtl
String class = "de.iip_ecosphere.platform.connectors.mqtt.MqttConnectorFactory";
String artifact ="de.iip-ecosphere.platform:connectors.mqtt:";
Port port = 1883;
String deviceServiceKey = "mqtt";
NameplateInfo nameplateInfo = {
manufacturerProductDesignation = "Generic MQTT connector@en",
manufacturer = refBy(manufacturer_sse)
};
assign (uiGroup = UiInvisibleGroup) to {
String class = "de.iip_ecosphere.platform.connectors.mqtt.MqttConnectorFactory";
String artifact ="de.iip-ecosphere.platform:connectors.mqtt:";
NameplateInfo nameplateInfo = {
manufacturerProductDesignation = "Generic MQTT connector@en",
manufacturer = refBy(manufacturer_sse)
};
}
assign (uiGroup = UiOptionalGroup1) to {
Port port = 1883;
}
assign (uiGroup = UiOptionalGroup2) to {
String deviceServiceKey = "mqtt";
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ project DataTypes {
const String Eclass_Property_swName = "0173-1#02-AAO247#002";

const Integer UiInvisibleGroup = 0;
const Integer UiMandatoryGroup1 = 1;
const Integer UiOptionalGroup1 = -1;
const Integer UiMandatoryGroup2 = 2;
const Integer UiOptionalGroup2 = -2;
const Integer UiMandatoryGroup1 = 100;
const Integer UiOptionalGroup1 = -100;
const Integer UiMandatoryGroup2 = 200;
const Integer UiOptionalGroup2 = -200;

def String mvnVersion(OktoVersion ver, Boolean snapshot) =
if (snapshot) then ver + "-SNAPSHOT" else ver endif;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ project Services {
Boolean asynchronous = true;
sequenceOf(IOType) input;
sequenceOf(IOType) output;
setOf(refTo(Dependency)) dependencies = {};
NameplateInfo nameplateInfo;
assign (uiGroup = UiOptionalGroup1) to {
NameplateInfo nameplateInfo;
setOf(refTo(Dependency)) dependencies = {};
assign (semanticId = Eclass_Unit_MByte) to {
Integer memLimit = 0; // e.g., JVM memory limit in MBytes
}
Expand Down Expand Up @@ -200,13 +200,17 @@ project Services {
assign(semanticId = Eclass_Property_swVersion) to {
OktoVersion ver;
}
Boolean deployable;
setOf(String) artifacts = {};
assign (uiGroup = UiOptionalGroup1) to {
Boolean deployable;
setOf(String) artifacts = {};
}
}

// a service for which a complete implementation exists and no generated interfaces are needed
abstract compound CompleteService refines Service {
String artifact = ""; // optional maven artifact
assign (uiGroup = UiOptionalGroup1) to {
String artifact = ""; // optional maven artifact
}
}

// ------------------------------ Java services -------------------------------
Expand All @@ -232,12 +236,14 @@ project Services {
};

compound PythonService refines Service {
String entrypointModule; // optional, would override default ServiceEnvironment.py
String artifact;
String servicesPackageName = null; // use the default, helps in testing/mocking
//dependency refinement removed -> system dependencies, use VIL dynamic dispatch
PythonIntegrationMode integrationMode = PythonIntegrationMode::console_continuous;
String condaEnv;
assign (uiGroup = UiOptionalGroup1) to {
String entrypointModule; // optional, would override default ServiceEnvironment.py
String servicesPackageName = null; // use the default, helps in testing/mocking
PythonIntegrationMode integrationMode = PythonIntegrationMode::console_continuous;
String condaEnv;
}
dependencies.uiGroup = UiMandatoryGroup1;
//Constraint conda = isDefined(condaEnv) and condaEnv <> "" implies dependencies->->selectByType(SystemDependency)->select(d|d.key.startsWith("CONDA")).notEmpty();
}

Expand All @@ -262,53 +268,61 @@ project Services {
family.input->exists(t|t.type == selector.type) or family.output->exists(t|t.type == selector.type);

compound ServiceFamily refines ServiceBase, CFamily {
String description = "";
setOf(refTo(Service)) members; // refinement
Constraint typeCheck = members->collect(refTo(Service) s | s.kind).toSet().size() < 2;
FamilyMemberSelector selector;
Constraint familyKind = kind == members.asSequence().first().kind; // propagate
Constraint familySelectorOk = selector <> null implies selectorTypeOk(selector, self);
Constraint familyAllSync = members->forAll(m|m.asynchronous = self.asynchronous);
Constraint familyAllDeployable = members->collect(m|m.deployable).toSet().size() < 2;
Constraint familyParameterOk = members->forAll(m|m.parameter = self.parameter);
Constraint familyInputOk = members->forAll(m|m.input = self.input);
Constraint familyOutputOk = members->forAll(m|m.output = self.output);
setOf(refTo(Service)) members; // refinement
Constraint typeCheck = members->collect(refTo(Service) s | s.kind).toSet().size() < 2;
FamilyMemberSelector selector;
assign (uiGroup = UiOptionalGroup1) to {
String description = "";
}
Constraint familyKind = kind == members.asSequence().first().kind; // propagate
Constraint familySelectorOk = selector <> null implies selectorTypeOk(selector, self);
Constraint familyAllSync = members->forAll(m|m.asynchronous = self.asynchronous);
Constraint familyAllDeployable = members->collect(m|m.deployable).toSet().size() < 2;
Constraint familyParameterOk = members->forAll(m|m.parameter = self.parameter);
Constraint familyInputOk = members->forAll(m|m.input = self.input);
Constraint familyOutputOk = members->forAll(m|m.output = self.output);
}

// ----------------------------- server processes ---------------------------

// required by application, to be started/stopped
abstract compound Server {
NonEmptyString id;
String description = ""; // TODO Constraint: must be configured
assign(semanticId = Eclass_Property_swVersion) to {
OktoVersion ver;
}
NonEmptyString host = "127.0.0.1";
NonEmptyEphemeralPort port;
NonEmptyString executable;
NameplateInfo nameplateInfo;
String artifact = ""; // optional maven artifact
Boolean running = false; // running somewhere else, do we have to start it
Parameters parameter = {};
setOf(refTo(Dependency)) dependencies = {};
String transportChannel;
setOf(String) artifacts = {};
assign (uiGroup = UiOptionalGroup1) to {
NameplateInfo nameplateInfo;
String description = ""; // TODO Constraint: must be configured
String artifact = ""; // optional maven artifact
Boolean running = false; // running somewhere else, do we have to start it
Parameters parameter = {};
setOf(refTo(Dependency)) dependencies = {};
String transportChannel;
setOf(String) artifacts = {};
}
}

// direct Java-based Server, must implement Server interface
compound JavaServer refines Server {
NonEmptyString class;
String cmdArg; // for now, comma separated
assign (semanticId = Eclass_Unit_MByte) to {
Integer memLimit = 256; // e.g., JVM memory limit in MBytes
assign (uiGroup = UiOptionalGroup1) to {
String cmdArg; // for now, comma separated
assign (semanticId = Eclass_Unit_MByte) to {
Integer memLimit = 256; // e.g., JVM memory limit in MBytes
}
}
}

// python based server instance, based on PythonServiceEnvironment, may be generated, must implement Server interface
compound PythonServer refines Server {
NonEmptyString executable = "python";
String servicesPackageName = null; // use the default, helps in testing/mocking
assign (uiGroup = UiOptionalGroup1) to {
NonEmptyString executable = "python";
String servicesPackageName = null; // use the default, helps in testing/mocking
}
}

Constraint serversUnique = allInstances(Server)->isUnique(e|e.id);
Expand Down

0 comments on commit 45bde27

Please sign in to comment.