-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add sensorhub-process-template #20
Open
earocorn
wants to merge
1
commit into
opensensorhub:master
Choose a base branch
from
earocorn:process-template
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# [NAME] | ||
|
||
## Configuration | ||
|
||
Configuring the process requires: | ||
Select ```Processing``` from the left hand accordion control and right click for context sensitive menu in accordion control. | ||
Select the ```SensorML Stream Process``` Module | ||
- **Module Name:** A name for the instance of the processing module | ||
- **Description:** A description of the process chain | ||
- **SensorML File:** The path to a process description file, which can be a XML or JSON SensorML process description. | ||
- **Auto Start:** Check the box to start this module when OSH node is launched |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
description = 'Put your description here' | ||
ext.details = "Details here" | ||
version = '1.0.0' | ||
|
||
dependencies { | ||
implementation 'org.sensorhub:sensorhub-core:' + oshCoreVersion | ||
testImplementation('junit:junit:4.13.1') | ||
} | ||
|
||
// exclude tests requiring connection to the sensor | ||
// these have to be run manually | ||
// If tests are to be excluded list them here as follows | ||
// exclude '**/TestNameClass.class' | ||
test { | ||
useJUnit() | ||
} | ||
|
||
// add info to OSGi manifest | ||
osgi { | ||
manifest { | ||
attributes ('Bundle-Vendor': 'Botts Inc') | ||
attributes ('Bundle-Activator': 'com.sample.impl.process.processname.Activator') | ||
} | ||
} | ||
|
||
// add info to maven pom | ||
ext.pom >>= { | ||
developers { | ||
developer { | ||
id 'some id' | ||
name 'Your name' | ||
organization '' | ||
organizationUrl '' | ||
} | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...nsorhub-process-template/src/main/java/com/sample/impl/process/processname/Activator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.sample.impl.process.processname; | ||
|
||
import org.sensorhub.utils.OshBundleActivator; | ||
|
||
public class Activator extends OshBundleActivator { | ||
} |
45 changes: 45 additions & 0 deletions
45
...nsorhub-process-template/src/main/java/com/sample/impl/process/processname/MyProcess.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.sample.impl.process.processname; | ||
|
||
import net.opengis.swe.v20.Count; | ||
import org.sensorhub.api.processing.OSHProcessInfo; | ||
import org.vast.process.ExecutableProcessImpl; | ||
import org.vast.process.ProcessException; | ||
import org.vast.swe.SWEHelper; | ||
|
||
public class MyProcess extends ExecutableProcessImpl { | ||
|
||
public static final OSHProcessInfo INFO = new OSHProcessInfo("myprocessname", "Process Label", "Description of my process goes here", MyProcess.class); | ||
|
||
Count input1; | ||
Count output1; | ||
Count parameter1; | ||
|
||
/** | ||
* Typically, you will initialize your input, output, and parameter data structures in the constructor | ||
*/ | ||
protected MyProcess() { | ||
super(INFO); | ||
|
||
SWEHelper fac = new SWEHelper(); | ||
// Create process inputs, outputs, and parameters | ||
this.inputData.add("input1", input1 = fac.createCount().build()); | ||
this.outputData.add("output1", output1 = fac.createCount().build()); | ||
this.paramData.add("parameter1", parameter1 = fac.createCount().build()); // Optional | ||
} | ||
|
||
/** | ||
* Process execution method. This is what gets called when your process runs | ||
* | ||
* @throws ProcessException | ||
*/ | ||
@Override | ||
public void execute() throws ProcessException { | ||
int paramValue = parameter1.getData().getIntValue(); | ||
int inputValue = input1.getData().getIntValue(); | ||
|
||
// Do whatever computations/processing with your input and parameter data, and use it to populate the output data blocks | ||
int equation = inputValue * paramValue; | ||
|
||
output1.getData().setIntValue(equation); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...rocess-template/src/main/java/com/sample/impl/process/processname/ProcessDescriptors.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.sample.impl.process.processname; | ||
|
||
import org.sensorhub.impl.processing.AbstractProcessProvider; | ||
|
||
public class ProcessDescriptors extends AbstractProcessProvider { | ||
|
||
public ProcessDescriptors() { | ||
addImpl(MyProcess.INFO); | ||
} | ||
|
||
} |
1 change: 1 addition & 0 deletions
1
...mplate/src/main/resources/META-INF/services/org.sensorhub.api.processing.IProcessProvider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
com.sample.impl.process.processname.ProcessDescriptors |
Empty file.
93 changes: 93 additions & 0 deletions
93
processing/sensorhub-process-template/src/test/resources/myprocess-description.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
{ | ||
"type": "AggregateProcess", | ||
"uniqueId": "[UUID or URN]", | ||
"label": "Human readable label for composite process", | ||
"description": "Description of the composite process", | ||
"outputs": [ | ||
{ | ||
"type": "Count", | ||
"name": "output1", | ||
"label": "Output 1", | ||
"definition": "http://sensorml.com/ont/swe/property/[DEFINITION]", | ||
"description": "Description of composite process' output" | ||
} | ||
], | ||
"components": [ | ||
{ | ||
"type": "SimpleProcess", | ||
"name": "source0", | ||
"typeOf": { | ||
"href": "urn:osh:process:datasource:stream" | ||
}, | ||
"configuration": { | ||
"setValues": [ | ||
{ | ||
"ref": "parameters/producerURI", | ||
"value": "urn:of:system:with:datastream" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"type": "SimpleProcess", | ||
"name": "process0", | ||
"label": "Process Label", | ||
"description": "Description of my process goes here", | ||
"typeOf": { | ||
"href": "urn:osh:process:myprocessname" | ||
}, | ||
"inputs": [ | ||
{ | ||
"type": "Count", | ||
"name": "input1" | ||
} | ||
], | ||
"outputs": [ | ||
{ | ||
"type": "Count", | ||
"name": "output1" | ||
} | ||
], | ||
"parameters": [ | ||
{ | ||
"type": "Count", | ||
"name": "param1", | ||
"value": 12345 | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "SimpleProcess", | ||
"name": "control0", | ||
"typeOf": { | ||
"href": "urn:osh:process:datasink:commandstream" | ||
}, | ||
"configuration": { | ||
"setValues": [ | ||
{ | ||
"ref": "parameters/systemUID", | ||
"value": "urn:to:system:with:controlstream" | ||
}, | ||
{ | ||
"ref": "parameters/inputName", | ||
"value": "controlStreamInputName" | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"connection": [ | ||
{ | ||
"source": "components/source0/outputs/anyOutputMatchingInput1Struct", | ||
"destination": "components/process0/inputs/input1" | ||
}, | ||
{ | ||
"source": "components/process0/outputs/output1", | ||
"destination": "components/control0/inputs/controlStreamInputName" | ||
}, | ||
{ | ||
"source": "components/process0/outputs/output1", | ||
"destination": "outputs/output1" | ||
} | ||
] | ||
} |
92 changes: 92 additions & 0 deletions
92
processing/sensorhub-process-template/src/test/resources/myprocess-description.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<sml:AggregateProcess xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sml="http://www.opengis.net/sensorml/2.0" xmlns:swe="http://www.opengis.net/swe/2.0" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gmd="http://www.isotc211.org/2005/gmd" gml:id="F1"> | ||
<gml:identifier codeSpace="uid">[UUID or URN]</gml:identifier> | ||
<sml:outputs> | ||
<sml:OutputList> | ||
<sml:output name="output1"> | ||
<swe:Count> | ||
<swe:label>Output 1</swe:label> | ||
</swe:Count> | ||
</sml:output> | ||
</sml:OutputList> | ||
</sml:outputs> | ||
<sml:components> | ||
<sml:ComponentList> | ||
<sml:component name="source0"> | ||
<sml:SimpleProcess gml:id="F2"> | ||
<sml:typeOf xlink:href="urn:osh:process:datasource:stream"/> | ||
<sml:configuration> | ||
<sml:Settings> | ||
<sml:setValue ref="parameters/producerURI">urn:of:system:with:datastream</sml:setValue> | ||
</sml:Settings> | ||
</sml:configuration> | ||
</sml:SimpleProcess> | ||
</sml:component> | ||
<sml:component name="process0"> | ||
<sml:SimpleProcess gml:id="F3"> | ||
<sml:typeOf xlink:href="urn:osh:process:myprocessname"/> | ||
<sml:inputs> | ||
<sml:InputList> | ||
<sml:input name="input1"> | ||
<swe:Count> | ||
<swe:label>Input 1</swe:label> | ||
</swe:Count> | ||
</sml:input> | ||
</sml:InputList> | ||
</sml:inputs> | ||
<sml:outputs> | ||
<sml:OutputList> | ||
<sml:output name="output1"> | ||
<swe:Count> | ||
<swe:label>Output 1</swe:label> | ||
</swe:Count> | ||
</sml:output> | ||
</sml:OutputList> | ||
</sml:outputs> | ||
<sml:parameters> | ||
<sml:ParameterList> | ||
<sml:parameter name="param1"> | ||
<swe:Count> | ||
<swe:label>Parameter 1</swe:label> | ||
<swe:value>12345</swe:value> | ||
</swe:Count> | ||
</sml:parameter> | ||
</sml:ParameterList> | ||
</sml:parameters> | ||
</sml:SimpleProcess> | ||
</sml:component> | ||
<sml:component name="control0"> | ||
<sml:SimpleProcess gml:id="F4"> | ||
<sml:typeOf xlink:href="urn:osh:process:datasink:commandstream"/> | ||
<sml:configuration> | ||
<sml:Settings> | ||
<sml:setValue ref="parameters/systemUID">urn:to:system:with:controlstreams</sml:setValue> | ||
<sml:setValue ref="parameters/inputName">controlStream1</sml:setValue> | ||
</sml:Settings> | ||
</sml:configuration> | ||
</sml:SimpleProcess> | ||
</sml:component> | ||
</sml:ComponentList> | ||
</sml:components> | ||
<sml:connections> | ||
<sml:ConnectionList> | ||
<sml:connection> | ||
<sml:Link> | ||
<sml:source ref="components/source0/outputs/GenericOutput/anyOutputMatchingInput1Struct"/> | ||
<sml:destination ref="components/process0/inputs/input1"/> | ||
</sml:Link> | ||
</sml:connection> | ||
<sml:connection> | ||
<sml:Link> | ||
<sml:source ref="components/process0/outputs/output1"/> | ||
<sml:destination ref="components/control0/inputs/controlStream1/anyInputMatchingOutput1Struct"/> | ||
</sml:Link> | ||
</sml:connection> | ||
<sml:connection> | ||
<sml:Link> | ||
<sml:source ref="components/process0/outputs/output1"/> | ||
<sml:destination ref="outputs/output1"/> | ||
</sml:Link> | ||
</sml:connection> | ||
</sml:ConnectionList> | ||
</sml:connections> | ||
</sml:AggregateProcess> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be best to use
subprojects = filetree(...)
as the processProjects is not currently visible in build.gradle, unless you add logic in build.gradle to pull in the sensorML descriptions and add them to the deployment configuration like subprojects