Skip to content

Add the packing protocol of 'sand-demo' #1

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions pack/lite/configuration/sand-demo/components.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[thing.socket.message.receiver]
port=6222
connection.timeout=600

[standard.client.message.processor]
tls.required=false
sasl.supported.mechanisms=DIGEST-MD5, CRAM-MD5

[ibr.supported.client.message.processor]
tls.required=false

[default.protocol.processing.processor]
relay.unknown.namespace.iq=false

[session.manager]
session.callback.check.interval=10000
45 changes: 45 additions & 0 deletions pack/lite/configuration/sand-demo/iot-component-binding-lite.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
stream.service$client.message.receivers=socket.message.receiver,thing.socket.message.receiver

socket.message.receiver$session.manager=lite.session.manager
socket.message.receiver$message.processor=standard.client.message.processor
socket.message.receiver$router=lite.router
socket.message.receiver$local.node.id.provider=lite.local.node.id.provider

standard.client.message.processor$session.manager=lite.session.manager
standard.client.message.processor$message.channel=lite.stream.2.parsing.message.channel
standard.client.message.processor$event.message.channel=lite.any.2.event.message.channel
standard.client.message.processor$router=lite.router

thing.socket.message.receiver$session.manager=lite.session.manager
thing.socket.message.receiver$message.processor=ibtr.supported.client.message.processor
thing.socket.message.receiver$router=lite.router
thing.socket.message.receiver$local.node.id.provider=lite.local.node.id.provider

ibtr.supported.client.message.processor$session.manager=lite.session.manager
ibtr.supported.client.message.processor$message.channel=lite.stream.2.parsing.message.channel
ibtr.supported.client.message.processor$event.message.channel=lite.any.2.event.message.channel
ibtr.supported.client.message.processor$router=lite.router

parsing.service$parsing.message.receiver=lite.stream.2.parsing.message.receiver
lite.stream.2.parsing.message.receiver$session.manager=lite.session.manager
lite.stream.2.parsing.message.receiver$message.channel=lite.parsing.2.processing.message.channel
lite.stream.2.parsing.message.receiver$message.processor=default.message.parsing.processor

processing.service$processing.message.receiver=lite.parsing.2.processing.message.receiver
lite.parsing.2.processing.message.receiver$session.manager=lite.session.manager
lite.parsing.2.processing.message.receiver$message.channel=lite.any.2.routing.message.channel
lite.parsing.2.processing.message.receiver$message.processor=default.protocol.processing.processor

event.service$event.message.receiver=lite.any.2.event.message.receiver
lite.any.2.event.message.receiver$message.processor=default.event.processor
lite.any.2.event.message.receiver$message.channel=lite.any.2.routing.message.channel
lite.any.2.event.message.receiver$session.manager=lite.session.manager

routing.service$routing.message.receiver=lite.any.2.routing.message.receiver
lite.any.2.routing.message.receiver$session.manager=lite.session.manager
lite.any.2.routing.message.receiver$message.channel=lite.routing.2.stream.message.channel
lite.any.2.routing.message.receiver$message.processor=default.routing.processor

stream.service$delivery.message.receiver=lite.routing.2.stream.message.receiver
lite.routing.2.stream.message.receiver$session.manager=lite.session.manager
lite.routing.2.stream.message.receiver$message.processor=default.delivery.message.processor
8 changes: 8 additions & 0 deletions pack/lite/configuration/sand-demo/plugins.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#[sand-server-things]
#thing.authorization.validity.time=300

#[sand-server-concentrator]
#node.confirmation.validity.time=300

#[sand-server-location]
#enabled=true
3 changes: 3 additions & 0 deletions pack/lite/configuration/sand-demo/server.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#disabled.services=stream.service
component.binding.profile=${config.dir}/iot-component-binding-lite.ini
domain.name=localhost
6 changes: 0 additions & 6 deletions pack/lite/iot-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,6 @@
<groupId>com.thefirstlineofcode.sand.server.lite</groupId>
<artifactId>sand-server-lite-friends</artifactId>
</dependency>

<!-- Sand Demo Plugins -->
<dependency>
<groupId>com.thefirstlineofcode.sand.demo</groupId>
<artifactId>sand-demo-server-lite</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
108 changes: 108 additions & 0 deletions pack/lite/sand-demo-pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.thefirstlineofcode.granite</groupId>
<artifactId>granite-pack</artifactId>
<version>1.0.5-RELEASE</version>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>com.thefirstlineofcode.granite.pack.lite</groupId>
<artifactId>granite-pack-lite-iot</artifactId>

<dependencies>
<!-- Sand Stream Plugin -->
<dependency>
<groupId>com.thefirstlineofcode.sand.server</groupId>
<artifactId>sand-server-stream</artifactId>
</dependency>

<!-- Granite Deploy Lite Plugins -->
<dependency>
<groupId>com.thefirstlineofcode.granite.lite</groupId>
<artifactId>granite-lite-dba</artifactId>
</dependency>
<dependency>
<groupId>com.thefirstlineofcode.granite.lite</groupId>
<artifactId>granite-lite-session</artifactId>
</dependency>
<dependency>
<groupId>com.thefirstlineofcode.granite.lite</groupId>
<artifactId>granite-lite-pipeline</artifactId>
</dependency>
<dependency>
<groupId>com.thefirstlineofcode.granite.lite</groupId>
<artifactId>granite-lite-auth</artifactId>
</dependency>
<dependency>
<groupId>com.thefirstlineofcode.granite.lite</groupId>
<artifactId>granite-lite-im</artifactId>
</dependency>

<!-- Sand Server Plugins -->
<dependency>
<groupId>com.thefirstlineofcode.sand.server</groupId>
<artifactId>sand-server-location</artifactId>
</dependency>
<dependency>
<groupId>com.thefirstlineofcode.sand.server</groupId>
<artifactId>sand-server-actuator</artifactId>
</dependency>
<dependency>
<groupId>com.thefirstlineofcode.sand.server</groupId>
<artifactId>sand-server-console</artifactId>
</dependency>
<dependency>
<groupId>com.thefirstlineofcode.sand.server</groupId>
<artifactId>sand-server-operator</artifactId>
</dependency>

<!-- Sand Deploy Lite Plugins -->
<dependency>
<groupId>com.thefirstlineofcode.sand.server.lite</groupId>
<artifactId>sand-server-lite-things</artifactId>
</dependency>
<dependency>
<groupId>com.thefirstlineofcode.sand.server.lite</groupId>
<artifactId>sand-server-lite-ibtr</artifactId>
</dependency>
<dependency>
<groupId>com.thefirstlineofcode.sand.server.lite</groupId>
<artifactId>sand-server-lite-concentrator</artifactId>
</dependency>
<dependency>
<groupId>com.thefirstlineofcode.sand.server.lite</groupId>
<artifactId>sand-server-lite-friends</artifactId>
</dependency>

<!-- Sand Demo Plugins -->
<dependency>
<groupId>com.thefirstlineofcode.sand.demo</groupId>
<artifactId>sand-demo-server-lite</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<mainClass>com.thefirstlineofcode.granite.lite.pack.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>

</project>

Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ private Options parseOptions(String[] args) {
options.setProtocol(Options.Protocol.STANDARD);
} else if ("iot".equals(args[i])) {
options.setProtocol(Options.Protocol.IOT);
} else if ("sand-demo".equals(args[i])) {
options.setProtocol(Protocol.SAND_DEMO);
} else {
throw new IllegalArgumentException(String.format("Illegal protocol: %s. Only 'mini', 'standard' and 'iot' are supported.", args[i]));
throw new IllegalArgumentException(String.format("Illegal protocol: %s. Only 'mini', 'standard', 'iot' and 'sand-demo' are supported.", args[i]));
}
i++;
} else if ("-webcamMode".equals(args[i])) {
Expand Down Expand Up @@ -146,7 +148,7 @@ private Options parseOptions(String[] args) {
}

if (options.getWebcamMode() == null) {
if (options.getProtocol() == Protocol.IOT) {
if (options.getProtocol() == Protocol.SAND_DEMO) {
options.setWebcamMode(WebcamMode.P2P);
} else {
options.setWebcamMode(WebcamMode.NONE);
Expand Down Expand Up @@ -177,7 +179,7 @@ private void printUsage() {
System.out.println("-cleanUpdate Clean and update specified modules.");
System.out.println("-cleanCache Clean the packing cache.");
System.out.println("-offline Run in offline mode.");
System.out.println("-protocol <PROTOCOL> Specify the protocol. Optional protocols are 'mini', 'standard' or 'iot'. Default is 'standard'.");
System.out.println("-protocol <PROTOCOL> Specify the protocol. Optional protocols are 'mini', 'standard', 'iot' or 'sand-demo'. Default is 'standard'.");
System.out.println("-webcamMode <WEBCAM-MODE> Specify that which webcam plugin needs to be deployed. Optional plugins are 'none', 'p2p', 'kurento'. Default is 'none'.");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public enum WebcamMode {
public enum Protocol {
MINI,
STANDARD,
IOT
IOT,
SAND_DEMO
}

public Options() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
public class Packer {
private static final String CONFIGURATION_DIR = "configuration";
private static final String SAND_PROJECT_PREFIX = "sand-";

private static final String SAND_DEMO_PROJECT_PREFIX = "sand-demo-";

private Options options;
private List<String> systemLibraries;

Expand Down Expand Up @@ -93,8 +94,9 @@ private void copyBasicServerToZip(File basicServerZip, ZipOutputStream zos) {
if (isSystemLibrary(entryName)) {
int lastSlash = entryName.lastIndexOf('/');
String libraryName = entryName.substring(lastSlash + 1);
if (libraryName.startsWith(SAND_PROJECT_PREFIX) &&
options.getProtocol() != Protocol.IOT)
if (libraryName.startsWith(SAND_PROJECT_PREFIX) && (options.getProtocol() != Protocol.IOT || options.getProtocol() != Protocol.SAND_DEMO))
continue;
if (libraryName.startsWith(SAND_DEMO_PROJECT_PREFIX) && options.getProtocol() != Protocol.SAND_DEMO)
continue;
systemLibraries.add(libraryName);
}
Expand Down Expand Up @@ -211,8 +213,10 @@ private void copyDependencies() {
PackUtils.runMvn(new File(options.getProjectDirPath()), options.isOffline(), "-fmini-pom.xml", "dependency:copy-dependencies");
} else if (options.getProtocol() == Options.Protocol.STANDARD) {
PackUtils.runMvn(new File(options.getProjectDirPath()), options.isOffline(), "-fstandard-pom.xml", "dependency:copy-dependencies");
} else {
} else if (options.getProtocol() == Protocol.IOT) {
PackUtils.runMvn(new File(options.getProjectDirPath()), options.isOffline(), "-fiot-pom.xml", "dependency:copy-dependencies");
} else {
PackUtils.runMvn(new File(options.getProjectDirPath()), options.isOffline(), "-fsand-demo-pom.xml", "dependency:copy-dependencies");

if (options.getWebcamMode() == WebcamMode.P2P) {
PackUtils.runMvn(new File(options.getProjectDirPath()), options.isOffline(), "-fp2p-webcam-pom.xml", "dependency:copy-dependencies");
Expand All @@ -239,8 +243,10 @@ private void writeGraniteConfigFilesToZip(String targetDirPath, ZipOutputStream
configurationFilesDir = new File(configurationDir, "standard");
} else if (options.getProtocol() == Options.Protocol.IOT) {
configurationFilesDir = new File(configurationDir, "iot");
} else if (options.getProtocol() == Protocol.SAND_DEMO) {
configurationFilesDir = new File(configurationDir, "sand-demo");
} else {
throw new IllegalArgumentException("Only support 'mini', 'standard' and 'iot' protocols now.");
throw new IllegalArgumentException("Only support 'mini', 'standard', 'iot' and 'sand-demo' protocols now.");
}

for (File configurationFile : configurationFilesDir.listFiles()) {
Expand Down