├── demos
├── openalt-2015
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ └── META-INF
│ │ │ │ └── beans.xml
│ │ │ └── java
│ │ │ └── io
│ │ │ └── silverware
│ │ │ └── demos
│ │ │ └── openalt
│ │ │ ├── ValueFilter.java
│ │ │ ├── RegisterTemperature.java
│ │ │ └── InfluxDBWriter.java
│ ├── README.md
│ └── pom.xml
├── lionsden-2016
│ ├── ariel
│ │ ├── src
│ │ │ └── main
│ │ │ │ ├── resources
│ │ │ │ └── META-INF
│ │ │ │ │ └── beans.xml
│ │ │ │ └── java
│ │ │ │ └── io
│ │ │ │ └── silverware
│ │ │ │ └── demos
│ │ │ │ └── lionsden
│ │ │ │ └── ThreadPoolResources.java
│ │ └── pom.xml
│ ├── babar
│ │ ├── src
│ │ │ └── main
│ │ │ │ ├── resources
│ │ │ │ └── META-INF
│ │ │ │ │ └── beans.xml
│ │ │ │ └── java
│ │ │ │ └── io
│ │ │ │ └── silverware
│ │ │ │ └── demos
│ │ │ │ └── lionsden
│ │ │ │ └── ServiceB.java
│ │ └── pom.xml
│ ├── corin
│ │ ├── src
│ │ │ └── main
│ │ │ │ ├── resources
│ │ │ │ └── META-INF
│ │ │ │ │ └── beans.xml
│ │ │ │ └── java
│ │ │ │ └── io
│ │ │ │ └── silverware
│ │ │ │ └── demos
│ │ │ │ └── lionsden
│ │ │ │ └── ServiceCImpl.java
│ │ └── pom.xml
│ ├── gur
│ │ └── src
│ │ │ └── main
│ │ │ ├── resources
│ │ │ └── META-INF
│ │ │ │ └── beans.xml
│ │ │ └── groovy
│ │ │ └── io
│ │ │ └── silverware
│ │ │ └── demos
│ │ │ └── lionsden
│ │ │ └── ServiceG.groovy
│ ├── dillen
│ │ ├── src
│ │ │ └── main
│ │ │ │ ├── resources
│ │ │ │ └── META-INF
│ │ │ │ │ └── beans.xml
│ │ │ │ └── java
│ │ │ │ └── io
│ │ │ │ └── silverware
│ │ │ │ └── demos
│ │ │ │ └── lionsden
│ │ │ │ └── ServiceC.java
│ │ └── pom.xml
│ └── pom.xml
└── devconf-2016
│ ├── gateway
│ ├── app
│ │ └── src
│ │ │ └── main
│ │ │ ├── resources
│ │ │ └── META-INF
│ │ │ │ └── beans.xml
│ │ │ └── java
│ │ │ └── io
│ │ │ └── silverware
│ │ │ └── demos
│ │ │ └── devconf
│ │ │ └── drools
│ │ │ └── MobileGatewayMicroservice.java
│ ├── ih-detail.png
│ ├── ih-overview.png
│ ├── kjar
│ │ ├── src
│ │ │ └── main
│ │ │ │ ├── resources
│ │ │ │ └── META-INF
│ │ │ │ │ └── kmodule.xml
│ │ │ │ └── java
│ │ │ │ └── io
│ │ │ │ └── silverware
│ │ │ │ └── demos
│ │ │ │ └── devconf
│ │ │ │ └── kjar
│ │ │ │ ├── Action.java
│ │ │ │ ├── Command.java
│ │ │ │ ├── MoodAction.java
│ │ │ │ ├── MobileButtonAction.java
│ │ │ │ ├── RfidAction.java
│ │ │ │ ├── WeatherAction.java
│ │ │ │ ├── FireplaceCommand.java
│ │ │ │ ├── AirConditioningCommand.java
│ │ │ │ ├── MediaCenterCommand.java
│ │ │ │ ├── Weather.java
│ │ │ │ ├── CacheStatus.java
│ │ │ │ └── LedState.java
│ │ └── pom.xml
│ ├── pom.xml
│ └── README.md
│ ├── devconf16.png
│ ├── README.md
│ └── inteligent-home
│ ├── src
│ ├── main
│ │ ├── resources
│ │ │ ├── home.conf.test
│ │ │ ├── log4j2.xml
│ │ │ ├── home.conf
│ │ │ └── home.conf.home
│ │ └── java
│ │ │ └── io
│ │ │ └── silverware
│ │ │ └── demos
│ │ │ └── devconf2016
│ │ │ └── intelligent_home
│ │ │ ├── routes
│ │ │ ├── IntelligentHomeRouteBuilder.java
│ │ │ ├── AcRouteBuilder.java
│ │ │ ├── ResetRouteBuilder.java
│ │ │ ├── FireplaceRouteBuilder.java
│ │ │ ├── RfidRouteBuilder.java
│ │ │ ├── SensorRouteBuilder.java
│ │ │ └── RgbLedRouteBuilder.java
│ │ │ ├── model
│ │ │ ├── RgbLed.java
│ │ │ ├── Channel.java
│ │ │ └── SensorData.java
│ │ │ ├── processors
│ │ │ ├── SilenceProcessor.java
│ │ │ ├── ConfigResetProcessor.java
│ │ │ ├── SoundProcessor.java
│ │ │ ├── ServoOpenProcessor.java
│ │ │ ├── RfidProcessor.java
│ │ │ ├── SensorDataProcessor.java
│ │ │ ├── Pca9685PwmSetProcessor.java
│ │ │ └── RgbLedProcessor.java
│ │ │ └── Pca9685Util.java
│ └── test
│ │ └── resources
│ │ ├── home.conf
│ │ └── log4j2.xml
│ └── pom.xml
├── quickstarts
├── activemq-jndi
│ ├── src
│ │ └── main
│ │ │ └── resources
│ │ │ ├── META-INF
│ │ │ └── beans.xml
│ │ │ ├── jndi.properties
│ │ │ └── broker
│ │ │ └── broker.xml
│ ├── log4j2.xml
│ └── pom.xml
├── activemq-secured
│ ├── src
│ │ └── main
│ │ │ └── resources
│ │ │ ├── META-INF
│ │ │ └── beans.xml
│ │ │ ├── jndi.properties
│ │ │ └── broker
│ │ │ └── broker.xml
│ ├── log4j2.xml
│ └── pom.xml
├── camel-jetty-cdi
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ └── META-INF
│ │ │ │ └── beans.xml
│ │ │ └── java
│ │ │ └── io
│ │ │ └── silverware
│ │ │ └── demos
│ │ │ └── quickstarts
│ │ │ └── cdi
│ │ │ ├── CamelCdiRoute.java
│ │ │ └── CamelCdiMicroservice.java
│ ├── README.md
│ ├── log4j2.xml
│ └── pom.xml
├── cdi-helloworld
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ └── META-INF
│ │ │ │ └── beans.xml
│ │ │ └── java
│ │ │ └── io
│ │ │ └── silverware
│ │ │ └── demos
│ │ │ └── quickstarts
│ │ │ └── cdi
│ │ │ └── CdiHelloWorldMicroservice.java
│ ├── README.md
│ ├── log4j2.xml
│ └── pom.xml
├── deltaspike-config
│ ├── src
│ │ └── main
│ │ │ └── resources
│ │ │ └── META-INF
│ │ │ └── beans.xml
│ ├── README.md
│ ├── log4j2.xml
│ └── pom.xml
├── hystrix-helloworld
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ ├── META-INF
│ │ │ │ └── beans.xml
│ │ │ └── log4j2.xml
│ │ │ └── java
│ │ │ └── io
│ │ │ └── silverware
│ │ │ └── demos
│ │ │ └── quickstarts
│ │ │ └── hystrix
│ │ │ ├── UnstableMicroservice.java
│ │ │ └── SlowMicroservice.java
│ └── README.md
├── vertx-helloworld
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ ├── META-INF
│ │ │ │ └── beans.xml
│ │ │ └── log4j2.xml
│ │ │ └── java
│ │ │ ├── verticle
│ │ │ └── MyVerticle.java
│ │ │ └── VertxMicroservice.java
│ ├── log4j2.xml
│ └── pom.xml
├── activemq-jms-annotation
│ ├── src
│ │ └── main
│ │ │ └── resources
│ │ │ ├── META-INF
│ │ │ └── beans.xml
│ │ │ └── broker
│ │ │ └── broker.xml
│ ├── log4j2.xml
│ └── pom.xml
├── camel-cdi-helloworld
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ └── META-INF
│ │ │ │ └── beans.xml
│ │ │ └── java
│ │ │ └── io
│ │ │ └── silverware
│ │ │ └── demos
│ │ │ └── quickstarts
│ │ │ └── cdi
│ │ │ ├── CamelCdiRoute.java
│ │ │ └── CamelCdiMicroservice.java
│ ├── README.md
│ ├── log4j2.xml
│ └── pom.xml
├── drools-helloworld
│ ├── app
│ │ ├── src
│ │ │ └── main
│ │ │ │ ├── resources
│ │ │ │ └── META-INF
│ │ │ │ │ └── beans.xml
│ │ │ │ └── java
│ │ │ │ └── io
│ │ │ │ └── silverware
│ │ │ │ └── demos
│ │ │ │ └── quickstarts
│ │ │ │ └── drools
│ │ │ │ └── DroolsHelloWorldMicroservice.java
│ │ └── pom.xml
│ ├── kjar
│ │ ├── src
│ │ │ └── main
│ │ │ │ └── resources
│ │ │ │ ├── org
│ │ │ │ └── drools
│ │ │ │ │ └── examples
│ │ │ │ │ └── testpackage
│ │ │ │ │ └── MyTestRule.drl
│ │ │ │ └── META-INF
│ │ │ │ └── kmodule.xml
│ │ └── pom.xml
│ ├── README.md
│ └── pom.xml
├── vertx-groovy-helloworld
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ ├── META-INF
│ │ │ │ └── beans.xml
│ │ │ └── log4j2.xml
│ │ │ └── java
│ │ │ ├── groovy
│ │ │ └── MyGroovyVerticle.groovy
│ │ │ └── VertxMicroservice.java
│ └── log4j2.xml
├── vertx-xml-helloworld
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ ├── META-INF
│ │ │ │ └── beans.xml
│ │ │ ├── vertx-config.xml
│ │ │ ├── javascriptVerticle.js
│ │ │ └── log4j2.xml
│ │ │ └── java
│ │ │ └── VertxMicroservice.java
│ ├── log4j2.xml
│ └── pom.xml
├── vertx-deployment-options
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ ├── META-INF
│ │ │ │ └── beans.xml
│ │ │ ├── example.json
│ │ │ ├── vertx-config.xml
│ │ │ ├── javascriptVerticle.js
│ │ │ └── log4j2.xml
│ │ │ └── java
│ │ │ ├── verticle
│ │ │ └── MyVerticle.java
│ │ │ └── VertxMicroservice.java
│ ├── log4j2.xml
│ └── pom.xml
├── openshift-base
│ ├── openshift-core
│ │ ├── src
│ │ │ └── main
│ │ │ │ ├── resources
│ │ │ │ └── META-INF
│ │ │ │ │ └── beans.xml
│ │ │ │ └── java
│ │ │ │ └── io
│ │ │ │ └── silverware
│ │ │ │ └── demos
│ │ │ │ └── quickstarts
│ │ │ │ └── openshift
│ │ │ │ └── cluster
│ │ │ │ └── api
│ │ │ │ ├── WorkerInterface.java
│ │ │ │ └── HealthStatus.java
│ │ └── pom.xml
│ ├── openshift-gateway
│ │ ├── src
│ │ │ └── main
│ │ │ │ ├── resources
│ │ │ │ ├── META-INF
│ │ │ │ │ └── beans.xml
│ │ │ │ ├── silverware.properties
│ │ │ │ └── jgroups_settings.xml
│ │ │ │ └── fabric8
│ │ │ │ └── route.yml
│ │ └── pom.xml
│ └── openshift-cluster-worker
│ │ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ ├── META-INF
│ │ │ │ └── beans.xml
│ │ │ ├── silverware.properties
│ │ │ └── jgroups_settings.xml
│ │ │ └── java
│ │ │ └── io
│ │ │ └── silverware
│ │ │ └── demos
│ │ │ └── quickstarts
│ │ │ └── openshift
│ │ │ └── cluster
│ │ │ └── api
│ │ │ ├── WorkerOld.java
│ │ │ └── WorkerNew.java
│ │ └── pom.xml
├── camel-helloworld
│ ├── README.md
│ ├── log4j2.xml
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── io
│ │ └── silverware
│ │ └── demos
│ │ └── quickstarts
│ │ └── camel
│ │ └── CamelHelloWorld.java
├── camel-helloworld-xml
│ ├── README.md
│ ├── src
│ │ └── main
│ │ │ └── resources
│ │ │ └── camel-dummy-route.xml
│ ├── log4j2.xml
│ └── pom.xml
├── http-server-helloworld
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ ├── quickstart-client.keystore
│ │ │ ├── quickstart-server.keystore
│ │ │ ├── quickstart-client.truststore
│ │ │ ├── quickstart-server.truststore
│ │ │ └── META-INF
│ │ │ │ └── beans.xml
│ │ │ └── java
│ │ │ └── io
│ │ │ └── silverware
│ │ │ └── demos
│ │ │ └── quickstarts
│ │ │ └── httpserver
│ │ │ └── HelloworldRestService.java
│ ├── pom.xml
│ └── README.md
└── rest-client-helloworld
│ ├── src
│ └── main
│ │ ├── resources
│ │ └── META-INF
│ │ │ └── beans.xml
│ │ └── java
│ │ └── io
│ │ └── silverware
│ │ └── demos
│ │ └── quickstarts
│ │ └── restclient
│ │ ├── HelloRestServiceProxy.java
│ │ ├── HelloRestService.java
│ │ └── ClientService.java
│ ├── README.md
│ └── pom.xml
├── .gitignore
└── README.md
/demos/openalt-2015/src/main/resources/META-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/demos/lionsden-2016/ariel/src/main/resources/META-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/demos/lionsden-2016/babar/src/main/resources/META-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/demos/lionsden-2016/corin/src/main/resources/META-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/demos/lionsden-2016/gur/src/main/resources/META-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/quickstarts/activemq-jndi/src/main/resources/META-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/demos/devconf-2016/gateway/app/src/main/resources/META-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/demos/lionsden-2016/dillen/src/main/resources/META-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/quickstarts/activemq-secured/src/main/resources/META-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/quickstarts/camel-jetty-cdi/src/main/resources/META-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/quickstarts/cdi-helloworld/src/main/resources/META-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/quickstarts/deltaspike-config/src/main/resources/META-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/quickstarts/hystrix-helloworld/src/main/resources/META-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/quickstarts/vertx-helloworld/src/main/resources/META-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/quickstarts/activemq-jms-annotation/src/main/resources/META-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/quickstarts/camel-cdi-helloworld/src/main/resources/META-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/quickstarts/drools-helloworld/app/src/main/resources/META-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/quickstarts/vertx-groovy-helloworld/src/main/resources/META-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/quickstarts/vertx-xml-helloworld/src/main/resources/META-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/quickstarts/vertx-deployment-options/src/main/resources/META-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/quickstarts/openshift-base/openshift-core/src/main/resources/META-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/quickstarts/openshift-base/openshift-gateway/src/main/resources/META-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/quickstarts/openshift-base/openshift-cluster-worker/src/main/resources/META-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/quickstarts/vertx-deployment-options/src/main/resources/example.json:
--------------------------------------------------------------------------------
1 | {
2 | "foo":"FOO",
3 | "bar":"BaR"
4 | }
--------------------------------------------------------------------------------
/demos/devconf-2016/devconf16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilverThings/SilverWare-Demos/HEAD/demos/devconf-2016/devconf16.png
--------------------------------------------------------------------------------
/demos/devconf-2016/gateway/ih-detail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilverThings/SilverWare-Demos/HEAD/demos/devconf-2016/gateway/ih-detail.png
--------------------------------------------------------------------------------
/demos/devconf-2016/gateway/ih-overview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilverThings/SilverWare-Demos/HEAD/demos/devconf-2016/gateway/ih-overview.png
--------------------------------------------------------------------------------
/quickstarts/camel-cdi-helloworld/README.md:
--------------------------------------------------------------------------------
1 | Shows integration of Camel and CDI using camel-cdi component.
2 | ```
3 | mvn clean package
4 | mvn exec:exec
5 | ```
6 |
--------------------------------------------------------------------------------
/quickstarts/camel-jetty-cdi/README.md:
--------------------------------------------------------------------------------
1 | Exposes a CDI service with a REST interface using Camel Jetty component.
2 |
3 | ```
4 | mvn clean package
5 | mvn exec:exec
6 | ```
--------------------------------------------------------------------------------
/quickstarts/cdi-helloworld/README.md:
--------------------------------------------------------------------------------
1 | Sample CDI Microservice demonstrating lifecycle events and handlers.
2 |
3 | ```
4 | mvn clean package
5 | java -jar target/cdi-helloworld-*.jar
6 | ```
--------------------------------------------------------------------------------
/quickstarts/camel-helloworld/README.md:
--------------------------------------------------------------------------------
1 | Microservice represented by Apache Camel as a route specified in a Java class.
2 |
3 | ```
4 | mvn clean package
5 | java -jar target/camel-helloworld-*.jar
6 | ```
--------------------------------------------------------------------------------
/quickstarts/openshift-base/openshift-gateway/src/main/resources/silverware.properties:
--------------------------------------------------------------------------------
1 | silverware.cluster.configuration=/deployments/jgroups_settings.xml
2 | silverware.cluster.lookup.timeout=3000
3 |
--------------------------------------------------------------------------------
/quickstarts/activemq-jndi/src/main/resources/jndi.properties:
--------------------------------------------------------------------------------
1 |
2 | java.naming.factory.initial=org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory
3 | connectionFactory.ConnectionFactory=vm://0
4 |
--------------------------------------------------------------------------------
/quickstarts/camel-helloworld-xml/README.md:
--------------------------------------------------------------------------------
1 | Microservice represented by Apache Camel as a route specified in an XML file.
2 |
3 | ```
4 | mvn clean package
5 | java -jar target/camel-helloworld-*.jar
6 | ```
--------------------------------------------------------------------------------
/quickstarts/openshift-base/openshift-cluster-worker/src/main/resources/silverware.properties:
--------------------------------------------------------------------------------
1 | silverware.cluster.configuration=/deployments/jgroups_settings.xml
2 | silverware.cluster.lookup.timeout=5000
3 |
--------------------------------------------------------------------------------
/quickstarts/activemq-secured/src/main/resources/jndi.properties:
--------------------------------------------------------------------------------
1 |
2 | java.naming.factory.initial=org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory
3 | connectionFactory.ConnectionFactory=vm://0
4 |
--------------------------------------------------------------------------------
/quickstarts/http-server-helloworld/src/main/resources/quickstart-client.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilverThings/SilverWare-Demos/HEAD/quickstarts/http-server-helloworld/src/main/resources/quickstart-client.keystore
--------------------------------------------------------------------------------
/quickstarts/http-server-helloworld/src/main/resources/quickstart-server.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilverThings/SilverWare-Demos/HEAD/quickstarts/http-server-helloworld/src/main/resources/quickstart-server.keystore
--------------------------------------------------------------------------------
/quickstarts/http-server-helloworld/src/main/resources/quickstart-client.truststore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilverThings/SilverWare-Demos/HEAD/quickstarts/http-server-helloworld/src/main/resources/quickstart-client.truststore
--------------------------------------------------------------------------------
/quickstarts/http-server-helloworld/src/main/resources/quickstart-server.truststore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilverThings/SilverWare-Demos/HEAD/quickstarts/http-server-helloworld/src/main/resources/quickstart-server.truststore
--------------------------------------------------------------------------------
/quickstarts/vertx-xml-helloworld/src/main/resources/vertx-config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | javascriptVerticle.js
6 |
7 |
--------------------------------------------------------------------------------
/quickstarts/vertx-deployment-options/src/main/resources/vertx-config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | javascriptVerticle.js
6 |
7 |
--------------------------------------------------------------------------------
/quickstarts/drools-helloworld/kjar/src/main/resources/org/drools/examples/testpackage/MyTestRule.drl:
--------------------------------------------------------------------------------
1 | package org.drools.examples.testpackage
2 |
3 | import java.lang.String;
4 |
5 | rule "rule 1"
6 | when
7 | $s : String()
8 | then
9 | System.out.println("Firing:" + $s);
10 | end
--------------------------------------------------------------------------------
/quickstarts/openshift-base/openshift-gateway/src/main/fabric8/route.yml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Route
3 | metadata:
4 | name: openshift-gateway
5 | spec:
6 | port:
7 | targetPort: 8080
8 | to:
9 | kind: Service
10 | name: openshift-gateway
11 | weight: 100
12 |
--------------------------------------------------------------------------------
/quickstarts/camel-helloworld-xml/src/main/resources/camel-dummy-route.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/quickstarts/http-server-helloworld/src/main/resources/META-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
--------------------------------------------------------------------------------
/quickstarts/rest-client-helloworld/src/main/resources/META-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | pom.xml.tag
3 | pom.xml.releaseBackup
4 | pom.xml.versionsBackup
5 | pom.xml.next
6 | release.properties
7 | dependency-reduced-pom.xml
8 | buildNumber.properties
9 | .idea
10 | *.log*
11 | *.iml
12 |
13 | #ActiveMQ
14 | activemq-data
15 | data
16 |
17 | #Vertx
18 | .vertx
19 |
20 | # Eclipse
21 | .classpath
22 | .project
23 | .settings
24 |
25 |
--------------------------------------------------------------------------------
/demos/devconf-2016/README.md:
--------------------------------------------------------------------------------
1 | # DevConf 2016 Demo
2 |
3 | ## Schema
4 |
5 | See the submodules for more information on the respective part.
6 |
7 | * _intelligent-home_ - represents the left side of the schema
8 | * _gateway_ - represents the right side of the schema
9 |
10 | 
11 |
--------------------------------------------------------------------------------
/quickstarts/drools-helloworld/kjar/src/main/resources/META-INF/kmodule.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/demos/devconf-2016/gateway/kjar/src/main/resources/META-INF/kmodule.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/quickstarts/vertx-deployment-options/src/main/resources/javascriptVerticle.js:
--------------------------------------------------------------------------------
1 | var log = Java.type("io.vertx.core.logging.LoggerFactory").getLogger('javascriptVerticle.js');
2 |
3 | exports.vertxStart = function() {
4 | log.info("javascriptVerticle is starting...");
5 |
6 | vertx.setPeriodic(1000, function (id) {
7 | log.info("The value of bar: " + vertx.getOrCreateContext().config().bar);
8 | });
9 | };
10 |
11 | exports.vertxStop = function() {
12 | log.info('javascriptVerticle stop called');
13 | };
--------------------------------------------------------------------------------
/quickstarts/vertx-xml-helloworld/src/main/resources/javascriptVerticle.js:
--------------------------------------------------------------------------------
1 | var log = Java.type("io.vertx.core.logging.LoggerFactory").getLogger('javascriptVerticle.js');
2 |
3 | exports.vertxStart = function() {
4 | log.info("javascriptVerticle is starting...");
5 |
6 | vertx.setPeriodic(1000, function (id) {
7 | vertx.eventBus().send("silverware.topic", "Hello from javascriptVerticle.js");
8 | });
9 | };
10 |
11 | exports.vertxStop = function() {
12 | log.info('javascriptVerticle stop called');
13 | };
--------------------------------------------------------------------------------
/quickstarts/rest-client-helloworld/src/main/java/io/silverware/demos/quickstarts/restclient/HelloRestServiceProxy.java:
--------------------------------------------------------------------------------
1 | package io.silverware.demos.quickstarts.restclient;
2 |
3 | import javax.ws.rs.GET;
4 | import javax.ws.rs.Path;
5 | import javax.ws.rs.Produces;
6 | import javax.ws.rs.core.MediaType;
7 |
8 | /**
9 | * @author Radek Koubsky (radekkoubsky@gmail.com)
10 | */
11 | public interface HelloRestServiceProxy {
12 | @Path("hello")
13 | @GET
14 | @Produces(MediaType.TEXT_PLAIN)
15 | String hello();
16 | }
17 |
--------------------------------------------------------------------------------
/quickstarts/hystrix-helloworld/README.md:
--------------------------------------------------------------------------------
1 | # Hystrix hello world quickstart
2 |
3 | 1. Run `mvn clean install -DskipTests` in the root directory of [SilverWare](https://github.com/SilverThings/SilverWare) project.
4 | 2. Run `mvn clean package cargo:start exec:exec` in **hystrix-helloworld** directory of this project.
5 | 3. Access [Hystrix Dashboard](https://github.com/Netflix/Hystrix/wiki/Dashboard) on [http://localhost:8081/hystrix-dashboard](http://localhost:8081/hystrix-dashboard).
6 | 4. Add a new stream with address [http://localhost:8080/hystrix.stream](http://localhost:8080/hystrix.stream) and start monitoring it.
7 |
--------------------------------------------------------------------------------
/demos/devconf-2016/inteligent-home/src/main/resources/home.conf.test:
--------------------------------------------------------------------------------
1 | iot.host=0.0.0.0:8282
2 | mqtt.host=localhost:1883
3 |
4 | pca9685.0=0x40
5 | pca9685.1=0x41
6 | pca9685.2=0x42
7 |
8 | dht11.address=0x43
9 |
10 | fan.gpio=P1_11
11 | fireplace.gpio=P1_13
12 |
13 | #;
14 | servo.0=2;0
15 |
16 | #;
17 | led.0.r=2;8
18 | led.0.g=2;10
19 | led.0.b=2;9
20 | led.1.r=2;14
21 | led.1.g=2;12
22 | led.1.b=2;13
23 | #dummy
24 | led.2.r=2;1
25 | led.2.g=2;2
26 | led.2.b=2;3
27 | led.3.r=2;4
28 | led.3.g=2;5
29 | led.3.b=2;6
30 | led.4.r=2;7
31 | led.4.g=2;11
32 | led.4.b=2;15
33 |
--------------------------------------------------------------------------------
/demos/devconf-2016/inteligent-home/src/test/resources/home.conf:
--------------------------------------------------------------------------------
1 | iot.host=0.0.0.0:8282
2 | mqtt.host=localhost:1883
3 |
4 | pca9685.0=0x00
5 | pca9685.1=0x01
6 | pca9685.2=0x02
7 |
8 | dht11.address=0x03
9 |
10 | fan.gpio=P1_13
11 | fireplace.gpio=P1_11
12 |
13 | #;
14 | servo.0=0;15
15 | servo.1=1;0
16 |
17 | #;
18 | led.0.r=0;0
19 | led.0.g=0;1
20 | led.0.b=0;2
21 | led.1.r=0;3
22 | led.1.g=0;4
23 | led.1.b=0;5
24 | led.2.r=0;6
25 | led.2.g=0;7
26 | led.2.b=0;8
27 | led.3.r=0;9
28 | led.3.g=0;10
29 | led.3.b=0;11
30 | led.4.r=0;12
31 | led.4.g=0;13
32 | led.4.b=0;14
33 |
--------------------------------------------------------------------------------
/quickstarts/vertx-groovy-helloworld/src/main/java/groovy/MyGroovyVerticle.groovy:
--------------------------------------------------------------------------------
1 | package groovy
2 |
3 | import io.vertx.core.logging.LoggerFactory
4 | import io.vertx.lang.groovy.GroovyVerticle
5 |
6 | public class MyGroovyVerticle extends GroovyVerticle {
7 |
8 | def logger = LoggerFactory.getLogger(this.class.getName())
9 |
10 | public void start() {
11 | logger.info("Starting " + this.class.getName())
12 |
13 | vertx.setPeriodic(1000, { id ->
14 | vertx.eventBus().send("silverware.topic", "Hello from " + this.class.getName())
15 | })
16 | }
17 |
18 | public void stop() {
19 | logger.info("Stopping" + this.class.getName())
20 | }
21 |
22 | }
--------------------------------------------------------------------------------
/demos/devconf-2016/inteligent-home/src/main/java/io/silverware/demos/devconf2016/intelligent_home/routes/IntelligentHomeRouteBuilder.java:
--------------------------------------------------------------------------------
1 | package io.silverware.demos.devconf2016.intelligent_home.routes;
2 |
3 | import org.apache.camel.builder.RouteBuilder;
4 |
5 | import io.silverware.demos.devconf2016.intelligent_home.Configuration;
6 |
7 | /**
8 | * Created by pmacik on 2.2.16.
9 | */
10 | public abstract class IntelligentHomeRouteBuilder extends RouteBuilder {
11 | protected Configuration config = Configuration.getInstance();
12 |
13 | public String restBaseUri() {
14 | return "jetty:http://" + config.getRestHost();
15 | }
16 |
17 | public String mqttHost() {
18 | return config.getMqttHost();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/quickstarts/rest-client-helloworld/src/main/java/io/silverware/demos/quickstarts/restclient/HelloRestService.java:
--------------------------------------------------------------------------------
1 | package io.silverware.demos.quickstarts.restclient;
2 |
3 | import io.silverware.microservices.annotations.Microservice;
4 |
5 | import javax.ws.rs.GET;
6 | import javax.ws.rs.Path;
7 | import javax.ws.rs.Produces;
8 | import javax.ws.rs.core.MediaType;
9 | import javax.ws.rs.core.Response;
10 |
11 | /**
12 | * @author Radek Koubsky (radekkoubsky@gmail.com)
13 | */
14 | @Microservice
15 | @Path("/hello_service")
16 | public class HelloRestService {
17 | @Path("hello")
18 | @GET
19 | @Produces(MediaType.TEXT_PLAIN)
20 | public Response hello() {
21 | return Response.ok("Hello world from REST service!").build();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/quickstarts/activemq-jndi/src/main/resources/broker/broker.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 | false
8 | target/data/journal
9 | false
10 |
11 |
12 |
13 | vm://0
14 |
15 |
16 |
17 | vm://0
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/quickstarts/http-server-helloworld/src/main/java/io/silverware/demos/quickstarts/httpserver/HelloworldRestService.java:
--------------------------------------------------------------------------------
1 | package io.silverware.demos.quickstarts.httpserver;
2 |
3 | import io.silverware.microservices.annotations.Microservice;
4 |
5 | import javax.ws.rs.GET;
6 | import javax.ws.rs.Path;
7 | import javax.ws.rs.Produces;
8 | import javax.ws.rs.core.MediaType;
9 | import javax.ws.rs.core.Response;
10 |
11 | /**
12 | * @author Radek Koubsky (radekkoubsky@gmail.com)
13 | */
14 | @Microservice
15 | @Path("/hello_service")
16 | public class HelloworldRestService {
17 | @Path("hello")
18 | @GET
19 | @Produces(MediaType.TEXT_PLAIN)
20 | public Response hello() {
21 | return Response.ok("Hello world from REST service!").build();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/quickstarts/activemq-jms-annotation/src/main/resources/broker/broker.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 | false
8 | target/data/journal
9 | false
10 |
11 |
12 |
13 | vm://0
14 |
15 |
16 |
17 | vm://0
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/quickstarts/openshift-base/openshift-gateway/src/main/resources/jgroups_settings.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
11 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/quickstarts/openshift-base/openshift-cluster-worker/src/main/resources/jgroups_settings.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
11 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/quickstarts/drools-helloworld/kjar/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 | io.silverware.demos.quickstarts
5 | drools-helloworld
6 | 2.1-SNAPSHOT
7 |
8 |
9 | drools-helloworld-kjar
10 | kjar
11 |
12 |
13 |
14 |
15 | org.kie
16 | kie-maven-plugin
17 | true
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/quickstarts/deltaspike-config/README.md:
--------------------------------------------------------------------------------
1 | This quickstart shows integration with Apache DeltaSpike
2 |
3 | ```
4 | $ mvn clean package
5 | $ mvn exec:exec
6 | ```
7 |
8 | To fully utilize the DeltaSpike configuration mechanism try running the resulting jar file manually with various options.
9 | Note: The logging property is there to bridge JUL to Log4j2 to get you a nicer output.
10 |
11 | ```
12 | $ java -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager -Ddb.port.mysql=111 -Ddb.port.postgresql=112 -Ddb.vendor=postgresql -jar deltaspike-config-*.jar
13 | ```
14 | ```
15 | $ java -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager -Ddb.port.mysql=4406 -Ddb.port.postgresql=6543 -Ddb.vendor=mysql -jar deltaspike-config-*.jar
16 | ```
17 |
18 | See how the configuration property 'dbPort' differs in the output.
--------------------------------------------------------------------------------
/demos/lionsden-2016/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 | io.silverware.demos
5 | demos-parent
6 | 2.0-SNAPSHOT
7 |
8 | lionsden-2016
9 | pom
10 |
11 | UTF-8
12 |
13 |
14 | ariel
15 | babar
16 | corin
17 | dillen
18 | gur
19 |
20 |
--------------------------------------------------------------------------------
/quickstarts/openshift-base/openshift-gateway/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | openshift-base
7 | io.silverware.demos.quickstarts
8 | 2.1-SNAPSHOT
9 |
10 | 4.0.0
11 | openshift-gateway
12 |
13 |
14 | io.silverware.demos.quickstarts
15 | openshift-core
16 | 2.1-SNAPSHOT
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/quickstarts/openshift-base/openshift-cluster-worker/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | openshift-base
7 | io.silverware.demos.quickstarts
8 | 2.1-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | 3
13 |
14 |
15 | openshift-cluster-worker
16 |
17 |
18 | io.silverware.demos.quickstarts
19 | openshift-core
20 | 2.1-SNAPSHOT
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/demos/devconf-2016/gateway/kjar/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 | io.silverware.demos
5 | gateway
6 | 2.0-SNAPSHOT
7 |
8 | gateway-kjar
9 | kjar
10 |
11 |
12 | org.apache.camel
13 | camel-core
14 |
15 |
16 |
17 |
18 |
19 | org.kie
20 | kie-maven-plugin
21 | true
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/quickstarts/activemq-jndi/log4j2.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/quickstarts/camel-jetty-cdi/log4j2.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/quickstarts/cdi-helloworld/log4j2.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/quickstarts/activemq-secured/log4j2.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/quickstarts/camel-cdi-helloworld/log4j2.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/quickstarts/camel-helloworld-xml/log4j2.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/quickstarts/camel-helloworld/log4j2.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/quickstarts/deltaspike-config/log4j2.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/quickstarts/vertx-helloworld/log4j2.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/quickstarts/vertx-xml-helloworld/log4j2.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/quickstarts/activemq-jms-annotation/log4j2.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/quickstarts/vertx-deployment-options/log4j2.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/quickstarts/vertx-groovy-helloworld/log4j2.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/quickstarts/vertx-helloworld/src/main/resources/log4j2.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/quickstarts/vertx-xml-helloworld/src/main/resources/log4j2.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/quickstarts/hystrix-helloworld/src/main/resources/log4j2.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/quickstarts/vertx-deployment-options/src/main/resources/log4j2.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/quickstarts/vertx-groovy-helloworld/src/main/resources/log4j2.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/quickstarts/activemq-secured/src/main/resources/broker/broker.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 | target/data/journal
8 |
9 |
10 |
11 | vm://0
12 |
13 |
14 |
15 | vm://0
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/demos/openalt-2015/README.md:
--------------------------------------------------------------------------------
1 | The idea
2 | ========
3 | Sensors are regularly posting their data through a REST interface to the sample service.
4 | The data are filtered for just changes in the values to be stored in the database.
5 | If a change is detected, the value is written in the time series in InfluxDB.
6 |
7 | How to build
8 | ============
9 | > mvn clean package
10 |
11 | How to run
12 | ==========
13 | > java -jar target/openalt-2015-*.jar "-Dinfluxdb.url=http://localhost:8086" "-Dinfluxdb.user=root" "-Dinfluxdb.password=root"
14 |
15 | You might have different configuration parameters to connect to your InfluxDB.
16 |
17 | How to test
18 | ===========
19 | Make sure you have sensors database created in your InfluxDB.
20 |
21 | Insert temperature data ('sensor1' is sensor name and 25 is the temperature in Celsius):
22 | > curl -i -X POST http://localhost:8081/rest/RegisterTemperature/temperature -d '[ "sensor1", 25 ]'
23 |
24 | Insert humidity data ('sensor1' is sensor name and 75 is the relative humidity):
25 | > curl -i -X POST http://localhost:8081/rest/RegisterTemperature/humidity -d '[ "sensor1", 75 ]'
26 |
--------------------------------------------------------------------------------
/quickstarts/rest-client-helloworld/src/main/java/io/silverware/demos/quickstarts/restclient/ClientService.java:
--------------------------------------------------------------------------------
1 | package io.silverware.demos.quickstarts.restclient;
2 |
3 | import io.silverware.microservices.annotations.Microservice;
4 | import io.silverware.microservices.annotations.MicroserviceReference;
5 | import io.silverware.microservices.providers.rest.annotation.ServiceConfiguration;
6 |
7 | import javax.inject.Inject;
8 | import javax.ws.rs.GET;
9 | import javax.ws.rs.Path;
10 | import javax.ws.rs.Produces;
11 | import javax.ws.rs.core.MediaType;
12 | import javax.ws.rs.core.Response;
13 |
14 | /**
15 | * @author Radek Koubsky (radekkoubsky@gmail.com)
16 | */
17 | @Microservice
18 | @Path("/client_service")
19 | public class ClientService {
20 | @Inject
21 | @MicroserviceReference
22 | @ServiceConfiguration(endpoint = "http://localhost:8080/silverware/rest/hello_service")
23 | HelloRestServiceProxy restService;
24 |
25 | @Path("call_rest_service")
26 | @GET
27 | @Produces(MediaType.TEXT_PLAIN)
28 | public Response callRestService() {
29 | return Response.ok(this.restService.hello()).build();
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/demos/lionsden-2016/dillen/src/main/java/io/silverware/demos/lionsden/ServiceC.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2014 - 2016 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.lionsden;
21 |
22 | /**
23 | * @author Martin Večeřa
24 | */
25 | public interface ServiceC {
26 |
27 | String upperCase(final String name);
28 | }
29 |
--------------------------------------------------------------------------------
/quickstarts/rest-client-helloworld/README.md:
--------------------------------------------------------------------------------
1 | # Hello world rest-client-microservice-provider
2 | A simple application demonstrating the use of **rest-client-microservice-provider**.
3 |
4 | The application consists of the following classes:
5 |
6 | * `ClientService` - a REST based microservice that will be used to access the application
7 | * `HelloRestService` - this is an arbitrary REST service which can be implemented in any language and located anywhere in the Internet, in this quickstart, the REST service is implemented in Java and is deployed within SilverWare using **http-server-microservice-provider**.
8 | * `HelloRestServiceProxy` - an interface that describes an arbitrary REST service (the `HelloRestService`) using the `javax.ws.rs` annotations, SilverWare will create a proxy that is injected into the `ClientService` microservice using **cdi-microservice-provider**, this proxy translates the interface method calls to the REST calls via HTTP
9 |
10 | Build and run the application
11 | ```
12 | mvn clean package
13 | java -jar target/rest-client-helloworld-*.jar
14 | ```
15 |
16 | Go to http://localhost:8080/silverware/rest/client_service/call_rest_service
--------------------------------------------------------------------------------
/demos/devconf-2016/gateway/kjar/src/main/java/io/silverware/demos/devconf/kjar/Action.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.devconf.kjar;
21 |
22 | import java.io.Serializable;
23 |
24 | /**
25 | * @author Martin Večeřa
26 | */
27 | public class Action implements Serializable {
28 | }
29 |
--------------------------------------------------------------------------------
/demos/devconf-2016/inteligent-home/src/main/java/io/silverware/demos/devconf2016/intelligent_home/model/RgbLed.java:
--------------------------------------------------------------------------------
1 | package io.silverware.demos.devconf2016.intelligent_home.model;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 |
6 | /**
7 | * Created by pmacik on 1.2.16.
8 | */
9 | public class RgbLed {
10 | private Map channelMap = new HashMap<>();
11 |
12 | public Map getChannelMap() {
13 | return channelMap;
14 | }
15 |
16 | public RgbLed setChannelMap(final Map channelMap) {
17 | this.channelMap = channelMap;
18 | return this;
19 | }
20 |
21 | @Override
22 | public boolean equals(final Object o) {
23 | if (this == o) {
24 | return true;
25 | }
26 | if (!(o instanceof RgbLed)) {
27 | return false;
28 | }
29 |
30 | final RgbLed rgbLed = (RgbLed) o;
31 |
32 | return getChannelMap() != null ? getChannelMap().equals(rgbLed.getChannelMap()) : rgbLed.getChannelMap() == null;
33 |
34 | }
35 |
36 | @Override
37 | public int hashCode() {
38 | return getChannelMap() != null ? getChannelMap().hashCode() : 0;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SilverWare Examples
2 |
3 | In this repository you can find all demonstartions and quickstart examples for SilverWare.
4 | It is divided into two categories:
5 |
6 | 1. Demos - these are complex examples usually presented at conferences and other events.
7 | 2. Quickstarts - simple examples, each of the typically showing a single feature, can be used as basic building blocks and code templates.
8 |
9 | ## Demos
10 |
11 | * __openalt-2015__ Example showed at OpenAlt 2015 in Brno.
12 | Consists of three services - a temperature sensor register, a value filter that removes duplicates, and an InfluxDB writer. All are CDI microservices.
13 |
14 | ## Quickstarts
15 |
16 | * __camel-helloworld__ Simple Camel microservice - a route from timer to log and stream using route specified in a _Java class_.
17 | * __camel-helloworld-xml__ Simple Camel microservice - a route from timer to log and stream using route specified in an XML file.
18 | * __cdi-helloworld__ Integration of Camel and CDI microservices - a Camel route defined in a Java class sends messages to a CDI microservice.
19 |
20 | ---
21 |
22 | _Demos and Quickstarts have separate execution instructions in their particular readme files._
23 |
--------------------------------------------------------------------------------
/demos/devconf-2016/inteligent-home/src/main/resources/log4j2.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/demos/devconf-2016/inteligent-home/src/test/resources/log4j2.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/quickstarts/cdi-helloworld/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 | io.silverware.demos.quickstarts
5 | quickstarts-parent
6 | 2.1-SNAPSHOT
7 |
8 | cdi-helloworld
9 | jar
10 |
11 |
12 | io.silverware
13 | microservices
14 |
15 |
16 | io.silverware
17 | cdi-microservice-provider
18 |
19 |
20 |
21 |
22 |
23 | org.apache.maven.plugins
24 | maven-dependency-plugin
25 | ${version.maven.dependency.plugin}
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/demos/devconf-2016/inteligent-home/src/main/resources/home.conf:
--------------------------------------------------------------------------------
1 | iot.host=0.0.0.0:8282
2 | mqtt.host=localhost:1883
3 |
4 | pca9685.0=0x40
5 | pca9685.1=0x41
6 | pca9685.2=0x42
7 |
8 | dht11.address=0x43
9 |
10 | rfid.address=0x44
11 |
12 | fan.gpio=P1_13
13 | fireplace.gpio=P1_11
14 |
15 | #;
16 | servo.0=2;15
17 | servo.1=1;0
18 |
19 | #;
20 | led.0.r=1;13
21 | led.0.g=1;14
22 | led.0.b=1;15
23 | led.1.r=2;0
24 | led.1.g=2;6
25 | led.1.b=2;7
26 | led.2.r=2;5
27 | led.2.g=2;8
28 | led.2.b=2;4
29 | led.3.r=2;3
30 | led.3.g=2;1
31 | led.3.b=2;2
32 | led.4.r=2;9
33 | led.4.g=2;11
34 | led.4.b=2;10
35 | led.5.r=2;14
36 | led.5.g=2;12
37 | led.5.b=2;13
38 | led.6.r=0;14
39 | led.6.g=0;13
40 | led.6.b=0;12
41 | led.7.r=1;4
42 | led.7.g=1;8
43 | led.7.b=1;9
44 | led.8.r=1;1
45 | led.8.g=1;3
46 | led.8.b=1;2
47 | led.9.r=1;10
48 | led.9.g=1;11
49 | led.9.b=1;12
50 | led.10.r=0;9
51 | led.10.g=0;8
52 | led.10.b=0;15
53 | led.11.r=0;3
54 | led.11.g=0;1
55 | led.11.b=0;2
56 | led.12.r=1;7
57 | led.12.g=1;6
58 | led.12.b=1;5
59 | led.13.r=0;7
60 | led.13.g=0;5
61 | led.13.b=0;6
62 | led.14.r=0;4
63 | led.14.g=0;11
64 | led.14.b=0;10
65 |
--------------------------------------------------------------------------------
/demos/lionsden-2016/dillen/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 | io.silverware.demos
5 | lionsden-2016
6 | 2.0-SNAPSHOT
7 |
8 | lionsden-dillen
9 | jar
10 |
11 |
12 |
13 |
14 | io.silverware
15 | microservices
16 |
17 |
18 | io.silverware
19 | cdi-microservice-provider
20 |
21 |
22 |
23 |
24 |
25 | org.apache.maven.plugins
26 | maven-dependency-plugin
27 | ${version.maven.dependency.plugin}
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/demos/devconf-2016/inteligent-home/src/main/resources/home.conf.home:
--------------------------------------------------------------------------------
1 | iot.host=0.0.0.0:8282
2 | mqtt.host=localhost:1883
3 |
4 | pca9685.0=0x40
5 | pca9685.1=0x41
6 | pca9685.2=0x42
7 |
8 | dht11.address=0x43
9 |
10 | fan.gpio=P1_11
11 | fireplace.gpio=P1_13
12 |
13 | #;
14 | servo.0=2;15 #780-1040 main door
15 | servo.1=1;0 #670-1070 back door
16 |
17 | #;
18 | led.0.r=1;13
19 | led.0.g=1;14
20 | led.0.b=1;15
21 | led.1.r=2;0
22 | led.1.g=2;6
23 | led.1.b=2;7
24 | led.2.r=2;5
25 | led.2.g=2;8
26 | led.2.b=2;4
27 | led.3.r=2;3
28 | led.3.g=2;1
29 | led.3.b=2;2
30 | led.4.r=2;9
31 | led.4.g=2;11
32 | led.4.b=2;10
33 | led.5.r=2;14
34 | led.5.g=2;12
35 | led.5.b=2;13
36 | led.6.r=0;14
37 | led.6.g=0;13
38 | led.6.b=0;12
39 | led.7.r=1;4
40 | led.7.g=1;8
41 | led.7.b=1;9
42 | led.8.r=1;1
43 | led.8.g=1;3
44 | led.8.b=1;2
45 | led.9.r=1;10
46 | led.9.g=1;11
47 | led.9.b=1;12
48 | led.10.r=0;9
49 | led.10.g=0;8
50 | led.10.b=0;15
51 | led.11.r=0;3
52 | led.11.g=0;1
53 | led.11.b=0;2
54 | led.12.r=1;7
55 | led.12.g=1;6
56 | led.12.b=1;5
57 | led.13.r=0;7
58 | led.13.g=0;5
59 | led.13.b=0;6
60 | led.14.r=0;4
61 | led.14.g=0;11
62 | led.14.b=0;10
63 |
--------------------------------------------------------------------------------
/quickstarts/drools-helloworld/README.md:
--------------------------------------------------------------------------------
1 | Demonstrates integration of Drools Knowledge JARs into SilverWare.
2 | Any kjar present on the classpath is recognized by the KIE CDI extension and its sessions are prepared for injection.
3 |
4 | In this example, there are two modules:
5 | * kjar - contains the knowledge module
6 | * app - the sample application injecting the kjar and firing its rule
7 |
8 | Run the following command in the project root (where this file is present). Due to the project structure, the app module cannot be built standalone unless kjar is installed in your local repository.
9 |
10 | `> mvn clean package`
11 |
12 | Then start SilverWare quickstart by
13 |
14 | `> java -jar app/target/drools-helloworld-*.jar`
15 |
16 | See the following output showing that the rules were fired:
17 | ```
18 | 2016-02-02 22:12:23,598 INFO {io.silverware.demos.quickstarts.drools.DroolsHelloWorldMicroservice} DroolsHelloWorldMicroservice constructor
19 | 2016-02-02 22:12:24,486 INFO {io.silverware.demos.quickstarts.drools.DroolsHelloWorldMicroservice} DroolsHelloWorldMicroservice MicroservicesStartedEvent KieSession[0]
20 | Firing:test
21 | 2016-02-02 22:12:24,520 INFO {io.silverware.demos.quickstarts.drools.DroolsHelloWorldMicroservice} Fired!
22 | ```
23 |
24 |
--------------------------------------------------------------------------------
/demos/devconf-2016/gateway/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 | io.silverware.demos
5 | demos-parent
6 | 2.0-SNAPSHOT
7 | ../../pom.xml
8 |
9 | gateway
10 | pom
11 |
12 | UTF-8
13 | 6.3.0.Final
14 |
15 |
16 | app
17 | kjar
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | org.kie
26 | kie-maven-plugin
27 | ${version.drools}
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/demos/devconf-2016/gateway/kjar/src/main/java/io/silverware/demos/devconf/kjar/Command.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.devconf.kjar;
21 |
22 | import java.io.Serializable;
23 | import java.util.Map;
24 |
25 | /**
26 | * @author Martin Večeřa
27 | */
28 | public class Command implements Serializable {
29 |
30 | public Map getCacheUpdate() {
31 | return null;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/demos/lionsden-2016/gur/src/main/groovy/io/silverware/demos/lionsden/ServiceG.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2014 - 2016 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.lionsden;
21 |
22 | import io.silverware.microservices.annotations.Gateway;
23 | import io.silverware.microservices.annotations.Microservice;
24 |
25 | /**
26 | * @author Martin Večeřa
27 | */
28 | @Microservice
29 | @Gateway
30 | public class ServiceG {
31 |
32 | public String duke() {
33 | "duke"
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/demos/openalt-2015/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 | io.silverware.demos
5 | demos-parent
6 | 2.0-SNAPSHOT
7 |
8 | openalt-2015
9 | jar
10 |
11 |
12 | io.silverware
13 | microservices
14 |
15 |
16 | io.silverware
17 | cdi-microservice-provider
18 |
19 |
20 | org.influxdb
21 | influxdb-java
22 | 2.0
23 |
24 |
25 |
26 |
27 |
28 | org.apache.maven.plugins
29 | maven-dependency-plugin
30 | ${version.maven.dependency.plugin}
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/quickstarts/camel-helloworld/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 | io.silverware.demos.quickstarts
5 | quickstarts-parent
6 | 2.1-SNAPSHOT
7 |
8 | camel-helloworld
9 | jar
10 |
11 |
12 | io.silverware
13 | microservices
14 |
15 |
16 | io.silverware
17 | camel-microservice-provider
18 |
19 |
20 | org.apache.camel
21 | camel-stream
22 |
23 |
24 |
25 |
26 |
27 | org.apache.maven.plugins
28 | maven-dependency-plugin
29 | ${version.maven.dependency.plugin}
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/quickstarts/camel-helloworld-xml/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 | io.silverware.demos.quickstarts
5 | quickstarts-parent
6 | 2.1-SNAPSHOT
7 |
8 | camel-helloworld-xml
9 | jar
10 |
11 |
12 | io.silverware
13 | microservices
14 |
15 |
16 | io.silverware
17 | camel-microservice-provider
18 |
19 |
20 | org.apache.camel
21 | camel-stream
22 |
23 |
24 |
25 |
26 |
27 | org.apache.maven.plugins
28 | maven-dependency-plugin
29 | ${version.maven.dependency.plugin}
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/quickstarts/camel-helloworld/src/main/java/io/silverware/demos/quickstarts/camel/CamelHelloWorld.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.quickstarts.camel;
21 |
22 | import org.apache.camel.builder.RouteBuilder;
23 |
24 | /**
25 | * @author Martin Večeřa
26 | */
27 | public class CamelHelloWorld extends RouteBuilder {
28 |
29 | @Override
30 | public void configure() throws Exception {
31 | from("timer://foo?period=2000").to("log:test").to("stream:out");
32 | }
33 |
34 | }
--------------------------------------------------------------------------------
/quickstarts/camel-jetty-cdi/src/main/java/io/silverware/demos/quickstarts/cdi/CamelCdiRoute.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.quickstarts.cdi;
21 |
22 | import org.apache.camel.builder.RouteBuilder;
23 |
24 | /**
25 | * @author Martin Večeřa
26 | */
27 | public class CamelCdiRoute extends RouteBuilder {
28 |
29 | @Override
30 | public void configure() throws Exception {
31 | from("jetty:http://localhost:8082/camel")
32 | .beanRef("camelCdiMicroservice", "sayHello");
33 | }
34 |
35 | }
--------------------------------------------------------------------------------
/demos/lionsden-2016/corin/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 | io.silverware.demos
5 | lionsden-2016
6 | 2.0-SNAPSHOT
7 |
8 | lionsden-corin
9 | jar
10 |
11 |
12 |
13 |
14 | io.silverware
15 | microservices
16 |
17 |
18 | io.silverware
19 | cdi-microservice-provider
20 |
21 |
22 | io.silverware.demos
23 | lionsden-dillen
24 | ${project.version}
25 |
26 |
27 |
28 |
29 |
30 | org.apache.maven.plugins
31 | maven-dependency-plugin
32 | ${version.maven.dependency.plugin}
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/quickstarts/vertx-helloworld/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | quickstarts-parent
7 | io.silverware.demos.quickstarts
8 | 2.1-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | vertx-helloworld
13 | jar
14 |
15 |
16 |
17 | io.silverware
18 | microservices
19 |
20 |
21 | io.silverware
22 | cdi-microservice-provider
23 |
24 |
25 | io.silverware
26 | vertx-microservice-provider
27 |
28 |
29 |
30 |
31 |
32 | org.apache.maven.plugins
33 | maven-dependency-plugin
34 | ${version.maven.dependency.plugin}
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/demos/devconf-2016/inteligent-home/src/main/java/io/silverware/demos/devconf2016/intelligent_home/processors/SilenceProcessor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.devconf2016.intelligent_home.processors;
21 |
22 | import org.apache.camel.Exchange;
23 | import org.apache.camel.Processor;
24 |
25 | /**
26 | * @author Pavel Macík
27 | */
28 | public class SilenceProcessor implements Processor {
29 |
30 | @Override
31 | public void process(final Exchange exchange) throws Exception {
32 | Process p = Runtime.getRuntime().exec("killall aplay");
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/demos/lionsden-2016/corin/src/main/java/io/silverware/demos/lionsden/ServiceCImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2014 - 2016 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.lionsden;
21 |
22 | import io.silverware.microservices.annotations.Gateway;
23 | import io.silverware.microservices.annotations.Microservice;
24 | import io.silverware.microservices.annotations.ParamName;
25 |
26 | /**
27 | * @author Martin Večeřa
28 | */
29 | @Microservice
30 | @Gateway
31 | public class ServiceCImpl implements ServiceC {
32 |
33 | public String upperCase(@ParamName("arg0") final String name) {
34 | return name.toUpperCase();
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/quickstarts/openshift-base/openshift-core/src/main/java/io/silverware/demos/quickstarts/openshift/cluster/api/WorkerInterface.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * Silverware
4 | *
5 | * Copyright (C) 2010 - 2016 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.quickstarts.openshift.cluster.api;
21 |
22 | /**
23 | * Interface for clustered service
24 | *
25 | * @author Slavomír Krupa (slavomir.krupa@gmail.com)
26 | */
27 | public interface WorkerInterface {
28 | String HELLO = "Hello World!";
29 | String VERSION_1 = "1.1";
30 | String VERSION_2 = "2.5";
31 |
32 | String callHello();
33 |
34 | String getVersion();
35 |
36 | CustomObject customSerialization(CustomObject customObject);
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/quickstarts/camel-cdi-helloworld/src/main/java/io/silverware/demos/quickstarts/cdi/CamelCdiRoute.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.quickstarts.cdi;
21 |
22 | import org.apache.camel.builder.RouteBuilder;
23 |
24 | /**
25 | * @author Martin Večeřa
26 | */
27 | public class CamelCdiRoute extends RouteBuilder {
28 |
29 | @Override
30 | public void configure() throws Exception {
31 | from("timer://foo?period=2000")
32 | .setBody().simple("Hello from Camel Timer!")
33 | .bean("camelCdiMicroservice", "sayHello")
34 | .to("log:test").to("stream:out");
35 | }
36 |
37 | }
--------------------------------------------------------------------------------
/demos/lionsden-2016/ariel/src/main/java/io/silverware/demos/lionsden/ThreadPoolResources.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2014 - 2016 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.lionsden;
21 |
22 | import io.silverware.microservices.annotations.Microservice;
23 |
24 | import javax.enterprise.inject.Produces;
25 | import javax.inject.Named;
26 | import java.util.concurrent.Executors;
27 | import java.util.concurrent.ThreadPoolExecutor;
28 |
29 | /**
30 | * @author Martin Večeřa
31 | */
32 | @Microservice
33 | public class ThreadPoolResources {
34 |
35 | @Produces
36 | @Named("myCoolPool")
37 | public ThreadPoolExecutor getPool() {
38 | return (ThreadPoolExecutor) Executors.newFixedThreadPool(10);
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/quickstarts/drools-helloworld/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 | io.silverware.demos.quickstarts
5 | quickstarts-parent
6 | 2.1-SNAPSHOT
7 |
8 | drools-helloworld
9 | pom
10 |
11 | UTF-8
12 | 6.3.0.Final
13 |
14 |
15 | app
16 | kjar
17 |
18 |
19 |
20 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | org.kie
34 | kie-maven-plugin
35 | ${version.drools}
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/demos/devconf-2016/inteligent-home/src/main/java/io/silverware/demos/devconf2016/intelligent_home/processors/ConfigResetProcessor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.devconf2016.intelligent_home.processors;
21 |
22 | import org.apache.camel.Exchange;
23 | import org.apache.camel.Processor;
24 |
25 | import io.silverware.demos.devconf2016.intelligent_home.Configuration;
26 |
27 | /**
28 | * @author Pavel Macík
29 | */
30 | public class ConfigResetProcessor implements Processor {
31 | private Configuration config = Configuration.getInstance();
32 |
33 | @Override
34 | public void process(final Exchange exchange) throws Exception {
35 | config.resetRgbLeds();
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/quickstarts/http-server-helloworld/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | quickstarts-parent
8 | io.silverware.demos.quickstarts
9 | 2.1-SNAPSHOT
10 |
11 | http-server-helloworld
12 | jar
13 |
14 | This quickstarts demonstrates the use of http server microservice provider.
15 |
16 |
17 |
18 | io.silverware
19 | microservices
20 |
21 |
22 | io.silverware
23 | cdi-microservice-provider
24 |
25 |
26 | io.silverware
27 | http-server-microservice-provider
28 |
29 |
30 |
31 |
32 |
33 |
34 | org.apache.maven.plugins
35 | maven-dependency-plugin
36 | ${version.maven.dependency.plugin}
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/demos/lionsden-2016/babar/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 | io.silverware.demos
5 | lionsden-2016
6 | 2.0-SNAPSHOT
7 |
8 | lionsden-babar
9 | jar
10 |
11 |
12 |
13 |
14 | io.silverware
15 | microservices
16 |
17 |
18 | io.silverware
19 | cdi-microservice-provider
20 |
21 |
22 | io.silverware
23 | rest-client-microservice-provider
24 |
25 |
26 | io.silverware.demos
27 | lionsden-dillen
28 | ${project.version}
29 |
30 |
31 |
32 |
33 |
34 | org.apache.maven.plugins
35 | maven-dependency-plugin
36 | ${version.maven.dependency.plugin}
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/quickstarts/activemq-jndi/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | quickstarts-parent
7 | io.silverware.demos.quickstarts
8 | 2.1-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | activemq-jndi
13 | jar
14 |
15 |
16 |
17 | io.silverware
18 | microservices
19 |
20 |
21 | io.silverware
22 | cdi-microservice-provider
23 |
24 |
25 | io.silverware
26 | activemq-microservice-provider
27 |
28 |
29 | org.apache.activemq
30 | artemis-jms-server
31 |
32 |
33 |
34 |
35 |
36 | org.apache.maven.plugins
37 | maven-dependency-plugin
38 | ${version.maven.dependency.plugin}
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/quickstarts/drools-helloworld/app/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 | io.silverware.demos.quickstarts
5 | drools-helloworld
6 | 2.1-SNAPSHOT
7 |
8 | drools-helloworld-app
9 | jar
10 |
11 |
12 | io.silverware
13 | microservices
14 |
15 |
16 | io.silverware
17 | cdi-microservice-provider
18 |
19 |
20 | io.silverware
21 | drools-microservice-provider
22 |
23 |
24 | io.silverware.demos.quickstarts
25 | drools-helloworld-kjar
26 | ${project.version}
27 |
28 |
29 |
30 |
31 |
32 | org.apache.maven.plugins
33 | maven-dependency-plugin
34 | ${version.maven.dependency.plugin}
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/quickstarts/vertx-xml-helloworld/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | quickstarts-parent
7 | io.silverware.demos.quickstarts
8 | 2.1-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | vertx-xml-helloworld
13 |
14 |
15 | io.silverware
16 | microservices
17 |
18 |
19 | io.silverware
20 | cdi-microservice-provider
21 |
22 |
23 | io.silverware
24 | vertx-microservice-provider
25 |
26 |
27 | io.vertx
28 | vertx-lang-js
29 | 3.2.1
30 |
31 |
32 |
33 |
34 |
35 | org.apache.maven.plugins
36 | maven-dependency-plugin
37 | ${version.maven.dependency.plugin}
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/quickstarts/activemq-secured/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | quickstarts-parent
7 | io.silverware.demos.quickstarts
8 | 2.1-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | activemq-secured
13 | jar
14 |
15 |
16 |
17 | io.silverware
18 | microservices
19 |
20 |
21 | io.silverware
22 | cdi-microservice-provider
23 |
24 |
25 | io.silverware
26 | activemq-microservice-provider
27 |
28 |
29 | org.apache.activemq
30 | artemis-jms-server
31 |
32 |
33 |
34 |
35 |
36 | org.apache.maven.plugins
37 | maven-dependency-plugin
38 | ${version.maven.dependency.plugin}
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/quickstarts/hystrix-helloworld/src/main/java/io/silverware/demos/quickstarts/hystrix/UnstableMicroservice.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2016 - 2017 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.quickstarts.hystrix;
21 |
22 | import io.silverware.microservices.annotations.Microservice;
23 |
24 | @Microservice
25 | public class UnstableMicroservice {
26 |
27 | public void failAlways() {
28 | fail(1.0);
29 | }
30 |
31 | public void failHalf() {
32 | fail(0.5);
33 | }
34 |
35 | public void failThird() {
36 | fail(0.33);
37 | }
38 |
39 | public void failZero() {
40 | fail(0);
41 | }
42 |
43 | private void fail(double failureRate) {
44 | if (Math.random() < failureRate) {
45 | throw new RuntimeException("failing");
46 | }
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/quickstarts/activemq-jms-annotation/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | quickstarts-parent
7 | io.silverware.demos.quickstarts
8 | 2.1-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | activemq-jms-annotation
13 | jar
14 |
15 |
16 |
17 | io.silverware
18 | microservices
19 |
20 |
21 | io.silverware
22 | cdi-microservice-provider
23 |
24 |
25 | io.silverware
26 | activemq-microservice-provider
27 |
28 |
29 | org.apache.activemq
30 | artemis-jms-server
31 |
32 |
33 |
34 |
35 |
36 | org.apache.maven.plugins
37 | maven-dependency-plugin
38 | ${version.maven.dependency.plugin}
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/quickstarts/vertx-deployment-options/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | quickstarts-parent
7 | io.silverware.demos.quickstarts
8 | 2.1-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | vertx-deployment-options
13 | jar
14 |
15 |
16 |
17 | io.silverware
18 | microservices
19 |
20 |
21 | io.silverware
22 | cdi-microservice-provider
23 |
24 |
25 | io.silverware
26 | vertx-microservice-provider
27 |
28 |
29 | io.vertx
30 | vertx-lang-js
31 | 3.2.1
32 |
33 |
34 |
35 |
36 |
37 | org.apache.maven.plugins
38 | maven-dependency-plugin
39 | ${version.maven.dependency.plugin}
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/demos/devconf-2016/inteligent-home/src/main/java/io/silverware/demos/devconf2016/intelligent_home/processors/SoundProcessor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.devconf2016.intelligent_home.processors;
21 |
22 | import org.apache.camel.Exchange;
23 | import org.apache.camel.Message;
24 | import org.apache.camel.Processor;
25 |
26 | /**
27 | * @author Pavel Macík
28 | */
29 | public class SoundProcessor implements Processor {
30 |
31 | @Override
32 | public void process(final Exchange exchange) throws Exception {
33 | final Message in = exchange.getIn();
34 | final Object sound = in.getHeader("sound");
35 | if (sound != null) {
36 | Process p = Runtime.getRuntime().exec("aplay " + sound.toString());
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/quickstarts/camel-jetty-cdi/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 | io.silverware.demos.quickstarts
5 | quickstarts-parent
6 | 2.1-SNAPSHOT
7 |
8 | camel-jetty-cdi
9 | jar
10 |
11 |
12 | io.silverware
13 | microservices
14 |
15 |
16 | io.silverware
17 | cdi-microservice-provider
18 |
19 |
20 | io.silverware
21 | camel-microservice-provider
22 |
23 |
24 | io.silverware
25 | camel-cdi-integration
26 |
27 |
28 | org.apache.camel
29 | camel-jetty
30 |
31 |
32 |
33 |
34 |
35 | org.apache.maven.plugins
36 | maven-dependency-plugin
37 | ${version.maven.dependency.plugin}
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/demos/devconf-2016/inteligent-home/src/main/java/io/silverware/demos/devconf2016/intelligent_home/model/Channel.java:
--------------------------------------------------------------------------------
1 | package io.silverware.demos.devconf2016.intelligent_home.model;
2 |
3 | /**
4 | * Created by pmacik on 1.2.16.
5 | */
6 | public class Channel {
7 | private int pca9685Id = -1;
8 | private int pwm = -1;
9 | private int value = -1;
10 |
11 | public int getPca9685Id() {
12 | return pca9685Id;
13 | }
14 |
15 | public Channel setPca9685Id(final int pca9685Id) {
16 | this.pca9685Id = pca9685Id;
17 | return this;
18 | }
19 |
20 | public int getPwm() {
21 | return pwm;
22 | }
23 |
24 | public Channel setPwm(final int pwm) {
25 | this.pwm = pwm;
26 | return this;
27 | }
28 |
29 | public int getValue() {
30 | return value;
31 | }
32 |
33 | public Channel setValue(final int value) {
34 | this.value = value;
35 | return this;
36 | }
37 |
38 | @Override
39 | public boolean equals(final Object o) {
40 | if (this == o) {
41 | return true;
42 | }
43 | if (!(o instanceof Channel)) {
44 | return false;
45 | }
46 |
47 | final Channel channel = (Channel) o;
48 |
49 | if (getPca9685Id() != channel.getPca9685Id()) {
50 | return false;
51 | }
52 | if (getPwm() != channel.getPwm()) {
53 | return false;
54 | }
55 | return getValue() == channel.getValue();
56 |
57 | }
58 |
59 | @Override
60 | public int hashCode() {
61 | int result = getPca9685Id();
62 | result = 31 * result + getPwm();
63 | result = 31 * result + getValue();
64 | return result;
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/quickstarts/deltaspike-config/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 | io.silverware.demos.quickstarts
5 | quickstarts-parent
6 | 2.1-SNAPSHOT
7 |
8 | deltaspike-config
9 | jar
10 |
11 |
12 | io.silverware
13 | microservices
14 |
15 |
16 | io.silverware
17 | cdi-microservice-provider
18 |
19 |
20 | org.apache.deltaspike.core
21 | deltaspike-core-api
22 |
23 |
24 | org.apache.deltaspike.core
25 | deltaspike-core-impl
26 |
27 |
28 | org.apache.logging.log4j
29 | log4j-jul
30 |
31 |
32 |
33 |
34 |
35 | org.apache.maven.plugins
36 | maven-dependency-plugin
37 | ${version.maven.dependency.plugin}
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/quickstarts/hystrix-helloworld/src/main/java/io/silverware/demos/quickstarts/hystrix/SlowMicroservice.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2016 - 2017 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.quickstarts.hystrix;
21 |
22 | import io.silverware.microservices.annotations.Microservice;
23 |
24 | @Microservice
25 | public class SlowMicroservice {
26 |
27 | public void timeoutAlways() {
28 | timeout(1.0);
29 | }
30 |
31 | public void timeoutHalf() {
32 | timeout(0.5);
33 | }
34 |
35 | public void timeoutThird() {
36 | timeout(0.33);
37 | }
38 |
39 | public void timeoutZero() {
40 | timeout(0);
41 | }
42 |
43 | private void timeout(double failureRate) {
44 | if (Math.random() < failureRate) {
45 | try {
46 | Thread.sleep(2100);
47 | } catch (InterruptedException ex) {
48 |
49 | }
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/demos/devconf-2016/inteligent-home/src/main/java/io/silverware/demos/devconf2016/intelligent_home/routes/AcRouteBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.devconf2016.intelligent_home.routes;
21 |
22 | /**
23 | * @author Pavel Macík
24 | */
25 | public class AcRouteBuilder extends IntelligentHomeRouteBuilder {
26 | @Override
27 | public void configure() throws Exception {
28 | from(restBaseUri() + "/ac/on?httpMethodRestrict=GET")
29 | .to("direct:ac-on");
30 |
31 | from(restBaseUri() + "/ac/off?httpMethodRestrict=GET")
32 | .to("direct:ac-off");
33 |
34 | from("direct:ac-on")
35 | .to("bulldog:gpio?pin=" + config.getFanGpioPin() + "&value=HIGH");
36 |
37 | from("direct:ac-off")
38 | .to("bulldog:gpio?pin=" + config.getFanGpioPin() + "&value=LOW");
39 | }
40 | }
--------------------------------------------------------------------------------
/quickstarts/rest-client-helloworld/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | quickstarts-parent
8 | io.silverware.demos.quickstarts
9 | 2.1-SNAPSHOT
10 |
11 | rest-client-helloworld
12 | jar
13 |
14 | This quickstarts demonstrates the use of rest client microservice provider.
15 |
16 |
17 |
18 | io.silverware
19 | microservices
20 |
21 |
22 | io.silverware
23 | cdi-microservice-provider
24 |
25 |
26 | io.silverware
27 | rest-client-microservice-provider
28 |
29 |
30 | io.silverware
31 | http-server-microservice-provider
32 |
33 |
34 |
35 |
36 |
37 |
38 | org.apache.maven.plugins
39 | maven-dependency-plugin
40 | ${version.maven.dependency.plugin}
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/demos/devconf-2016/inteligent-home/src/main/java/io/silverware/demos/devconf2016/intelligent_home/routes/ResetRouteBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.devconf2016.intelligent_home.routes;
21 |
22 | /**
23 | * @author Pavel Macík
24 | */
25 | public class ResetRouteBuilder extends IntelligentHomeRouteBuilder {
26 |
27 | @Override
28 | public void configure() throws Exception {
29 | from("direct:reset")
30 | .setHeader("address", simple("0x70"))
31 | .to("direct:pca9685-reset")
32 | .to("direct:fireplace-off")
33 | .to("direct:ac-off")
34 | .to("direct:tv-reset");
35 |
36 | from("timer://initial-reset?repeatCount=1&delay=5000")
37 | .to("direct:reset");
38 |
39 | from(restBaseUri() + "/reset?httpMethodRestrict=GET")
40 | .to("direct:reset");
41 | }
42 | }
--------------------------------------------------------------------------------
/demos/devconf-2016/inteligent-home/src/main/java/io/silverware/demos/devconf2016/intelligent_home/processors/ServoOpenProcessor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.devconf2016.intelligent_home.processors;
21 |
22 | import org.apache.camel.Exchange;
23 | import org.apache.camel.Message;
24 | import org.apache.camel.Processor;
25 |
26 | import io.silverware.demos.devconf2016.intelligent_home.Configuration;
27 |
28 | /**
29 | * @author Pavel Macík
30 | */
31 | public class ServoOpenProcessor implements Processor {
32 | private Configuration config = Configuration.getInstance();
33 |
34 | @Override
35 | public void process(final Exchange exchange) throws Exception {
36 | Message in = exchange.getIn();
37 | Object valueHeader = in.getHeader("value");
38 | if (valueHeader == null) {
39 | in.setHeader("value", "100");
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/quickstarts/vertx-helloworld/src/main/java/verticle/MyVerticle.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 |
21 | package verticle;
22 |
23 | import io.vertx.core.AbstractVerticle;
24 | import io.vertx.core.logging.Logger;
25 | import io.vertx.core.logging.LoggerFactory;
26 |
27 | /**
28 | * @author Martin Štefanko
29 | */
30 | public class MyVerticle extends AbstractVerticle {
31 |
32 | private Logger log = LoggerFactory.getLogger(MyVerticle.class);
33 |
34 | @Override
35 | public void start() throws Exception {
36 | log.info(this.getClass().getName() + " is starting...");
37 | vertx.setPeriodic(1000, id -> {
38 | vertx.eventBus().send("silverware.topic", "Hello from " + this.getClass().getSimpleName());
39 | });
40 | }
41 |
42 | @Override
43 | public void stop() throws Exception {
44 | log.info(this.getClass().getSimpleName() + " is stopping");
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/demos/devconf-2016/inteligent-home/src/main/java/io/silverware/demos/devconf2016/intelligent_home/routes/FireplaceRouteBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.devconf2016.intelligent_home.routes;
21 |
22 | /**
23 | * @author Pavel Macík
24 | */
25 | public class FireplaceRouteBuilder extends IntelligentHomeRouteBuilder {
26 | @Override
27 | public void configure() throws Exception {
28 | from(restBaseUri() + "/fireplace/on?httpMethodRestrict=GET")
29 | .to("direct:fireplace-on");
30 |
31 | from(restBaseUri() + "/fireplace/off?httpMethodRestrict=GET")
32 | .to("direct:fireplace-off");
33 |
34 | from("direct:fireplace-on")
35 | .to("bulldog:gpio?pin=" + config.getFireplaceGpioPin() + "&value=LOW");
36 |
37 | from("direct:fireplace-off")
38 | .to("bulldog:gpio?pin=" + config.getFireplaceGpioPin() + "&value=HIGH");
39 | }
40 | }
--------------------------------------------------------------------------------
/demos/lionsden-2016/ariel/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 | io.silverware.demos
5 | lionsden-2016
6 | 2.0-SNAPSHOT
7 |
8 | lionsden-ariel
9 | jar
10 |
11 |
12 |
13 |
14 | io.silverware
15 | microservices
16 |
17 |
18 | io.silverware
19 | cdi-microservice-provider
20 |
21 |
22 | io.silverware
23 | rest-client-microservice-provider
24 |
25 |
26 | io.silverware.demos
27 | lionsden-dillen
28 | ${project.version}
29 |
30 |
31 | io.silverware.demos
32 | lionsden-gur
33 | ${project.version}
34 |
35 |
36 |
37 |
38 |
39 | org.apache.maven.plugins
40 | maven-dependency-plugin
41 | ${version.maven.dependency.plugin}
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/demos/lionsden-2016/babar/src/main/java/io/silverware/demos/lionsden/ServiceB.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2014 - 2016 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.lionsden;
21 |
22 | import javax.inject.Inject;
23 |
24 | import io.silverware.microservices.annotations.Gateway;
25 | import io.silverware.microservices.annotations.Microservice;
26 | import io.silverware.microservices.annotations.MicroserviceReference;
27 | import io.silverware.microservices.annotations.ParamName;
28 | import io.silverware.microservices.providers.rest.annotation.JsonService;
29 |
30 | /**
31 | * @author Martin Večeřa
32 | */
33 | @Microservice
34 | @Gateway
35 | public class ServiceB {
36 |
37 | @Inject
38 | @MicroserviceReference
39 | @JsonService(endpoint = "http://localhost:8083/rest/ServiceCImpl")
40 | private ServiceC upper;
41 |
42 | public String enrich(@ParamName("name") final String name) {
43 | return "Mr. " + upper.upperCase(name);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/quickstarts/camel-cdi-helloworld/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 | io.silverware.demos.quickstarts
5 | quickstarts-parent
6 | 2.1-SNAPSHOT
7 |
8 | camel-cdi-helloworld
9 | jar
10 |
11 |
12 | io.silverware
13 | microservices
14 |
15 |
16 | io.silverware
17 | cdi-microservice-provider
18 |
19 |
20 | io.silverware
21 | camel-microservice-provider
22 |
23 |
24 | io.silverware
25 | camel-cdi-integration
26 |
27 |
28 | org.apache.camel
29 | camel-stream
30 |
31 |
32 | org.testng
33 | testng
34 | test
35 |
36 |
37 |
38 |
39 |
40 | org.apache.maven.plugins
41 | maven-dependency-plugin
42 | ${version.maven.dependency.plugin}
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/quickstarts/vertx-deployment-options/src/main/java/verticle/MyVerticle.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 |
21 | package verticle;
22 |
23 | import io.silverware.microservices.annotations.Deployment;
24 |
25 | import io.vertx.core.AbstractVerticle;
26 | import io.vertx.core.logging.Logger;
27 | import io.vertx.core.logging.LoggerFactory;
28 |
29 | /**
30 | * @author Martin Štefanko
31 | */
32 | @Deployment(config = "src/main/resources/example.json")
33 | public class MyVerticle extends AbstractVerticle {
34 |
35 | private Logger log = LoggerFactory.getLogger(MyVerticle.class);
36 |
37 | @Override
38 | public void start() throws Exception {
39 | log.info(this.getClass().getName() + " is starting...");
40 | vertx.setPeriodic(1000, id -> {
41 | log.info("The value of foo: " + config().getString("foo"));
42 | });
43 | }
44 |
45 | @Override
46 | public void stop() throws Exception {
47 | log.info(this.getClass().getSimpleName() + " is stopping");
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/demos/devconf-2016/inteligent-home/src/main/java/io/silverware/demos/devconf2016/intelligent_home/processors/RfidProcessor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.devconf2016.intelligent_home.processors;
21 |
22 | import org.apache.camel.Exchange;
23 | import org.apache.camel.Message;
24 | import org.apache.camel.Processor;
25 |
26 | import io.silverware.demos.devconf2016.intelligent_home.Configuration;
27 |
28 | /**
29 | * @author Pavel Macík
30 | */
31 | public class RfidProcessor implements Processor {
32 | private Configuration config = Configuration.getInstance();
33 |
34 | @Override
35 | public void process(final Exchange exchange) throws Exception {
36 | final Message in = exchange.getIn();
37 |
38 | final String rfidAddress = config.getRfidAddress();
39 | if (rfidAddress == null) {
40 | throw new IllegalArgumentException("The address of RFID reader is invalid or not defined in " + Configuration.CONFIG_FILE);
41 | }
42 | in.setHeader("address", rfidAddress);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/quickstarts/vertx-xml-helloworld/src/main/java/VertxMicroservice.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 |
21 | import io.silverware.microservices.annotations.Microservice;
22 | import io.silverware.microservices.annotations.MicroserviceReference;
23 | import io.silverware.microservices.providers.cdi.MicroservicesStartedEvent;
24 |
25 | import io.vertx.core.Vertx;
26 | import io.vertx.core.logging.Logger;
27 | import io.vertx.core.logging.LoggerFactory;
28 |
29 | import javax.enterprise.event.Observes;
30 | import javax.inject.Inject;
31 |
32 | /**
33 | * @author Martin Stefanko (mstefank@redhat.com)
34 | */
35 | @Microservice("vertxMicroservice")
36 | public class VertxMicroservice {
37 |
38 | private Logger log = LoggerFactory.getLogger(VertxMicroservice.class);
39 |
40 | @Inject
41 | @MicroserviceReference
42 | private Vertx vertx;
43 |
44 |
45 | public void testVertx(@Observes MicroservicesStartedEvent event) {
46 |
47 | vertx.eventBus().consumer("silverware.topic", message -> {
48 | log.info("Received message: " + message.body());
49 | });
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/demos/openalt-2015/src/main/java/io/silverware/demos/openalt/ValueFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.openalt;
21 |
22 | import java.util.function.Consumer;
23 | import javax.inject.Inject;
24 |
25 | import io.silverware.microservices.annotations.Microservice;
26 | import io.silverware.microservices.annotations.MicroserviceReference;
27 | import io.silverware.microservices.providers.cdi.builtin.Storage;
28 |
29 | /**
30 | * @author Martin Večeřa
31 | */
32 | @Microservice
33 | public class ValueFilter {
34 |
35 | private final String STORAGE_PREFIX = ValueFilter.class.getCanonicalName() + ".";
36 |
37 | @Inject
38 | @MicroserviceReference
39 | private Storage storage;
40 |
41 | public void change(final String valueId, final T value, final Consumer consumer) {
42 | Object last = storage.get(STORAGE_PREFIX + valueId);
43 | if (last == null || !last.equals(value)) {
44 | consumer.accept(value);
45 | }
46 |
47 | storage.put(STORAGE_PREFIX + valueId, value);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/quickstarts/vertx-deployment-options/src/main/java/VertxMicroservice.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 |
21 | import io.silverware.microservices.annotations.Microservice;
22 | import io.silverware.microservices.annotations.MicroserviceReference;
23 | import io.silverware.microservices.providers.cdi.MicroservicesStartedEvent;
24 |
25 | import io.vertx.core.Vertx;
26 | import io.vertx.core.logging.Logger;
27 | import io.vertx.core.logging.LoggerFactory;
28 |
29 | import javax.enterprise.event.Observes;
30 | import javax.inject.Inject;
31 |
32 | /**
33 | * @author Martin Stefanko (mstefank@redhat.com)
34 | */
35 | @Microservice("vertxMicroservice")
36 | public class VertxMicroservice {
37 |
38 | private Logger log = LoggerFactory.getLogger(VertxMicroservice.class);
39 |
40 | @Inject
41 | @MicroserviceReference
42 | private Vertx vertx;
43 |
44 |
45 | public void testVertx(@Observes MicroservicesStartedEvent event) {
46 |
47 | vertx.eventBus().consumer("silverware.topic", message -> {
48 | log.info("Received message: " + message.body());
49 | });
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/quickstarts/vertx-helloworld/src/main/java/VertxMicroservice.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 |
21 | import io.silverware.microservices.annotations.Microservice;
22 | import io.silverware.microservices.annotations.MicroserviceReference;
23 | import io.silverware.microservices.providers.cdi.MicroservicesStartedEvent;
24 |
25 | import io.vertx.core.Vertx;
26 |
27 | import org.apache.logging.log4j.LogManager;
28 | import org.apache.logging.log4j.Logger;
29 |
30 | import javax.enterprise.event.Observes;
31 | import javax.inject.Inject;
32 |
33 | /**
34 | * @author Martin Stefanko (mstefank@redhat.com)
35 | */
36 | @Microservice("vertxMicroservice")
37 | public class VertxMicroservice {
38 |
39 | private Logger log = LogManager.getLogger(VertxMicroservice.class);
40 |
41 | @Inject
42 | @MicroserviceReference
43 | private Vertx vertx;
44 |
45 |
46 | public void testVertx(@Observes MicroservicesStartedEvent event) {
47 |
48 | vertx.eventBus().consumer("silverware.topic", message -> {
49 | log.info("Received message: " + message.body());
50 | });
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/demos/devconf-2016/gateway/README.md:
--------------------------------------------------------------------------------
1 | Complex demo to drive Intelligent Home on DevConf 2016
2 | ===
3 |
4 | Prerequisities:
5 | Install JBoss A-MQ, tested with version 6.2.1.redhat-084.
6 | Start the broker with `bin/standalone.sh`.
7 | Add an admin user mqtt/mqtt:
8 |
9 | ```
10 | JBossA-MQ:karaf@root> amq:create-admin-user
11 | Please specify a user...
12 | New user name: mqtt
13 | Password for mqtt:
14 | Verify password for mqtt:
15 | ```
16 |
17 | Provide the following system properties either by setting the environment or by using -Dpropert=value parameters.
18 |
19 | * iot.host - IP address and port of the RPI based services in the home
20 | * iot.mqtt.host - IP address and port of the RPi based MQTT broker that broadcasts messages on the home state, typically same as iot.host but with a different port number
21 | * mqtt.host - IP address and port of the A-MQ broker
22 | * mobile.host - IP address and port to which the internal REST server will be bind, this is the control interface for the mobile application
23 |
24 | Compile with:
25 |
26 | `mvn package`
27 |
28 | Run the jar file in app/target. Use the following parameters to fix logging of some components and provide system properties:
29 |
30 | `java -Diot.host=10.40.1.23:8282 -Diot.mqtt.host=10.40.1.23:1883 -Dmqtt.host=127.0.0.1:1883 -Dmobile.host=0.0.0.0:8283 -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager -jar app/target/gateway-app-2.0-SNAPSHOT.jar`
31 |
32 | Overview of the demo
33 | ====
34 |
35 | This demo covers everything that runs on OpenShift v3 in the following figure.
36 |
37 | 
38 |
39 | Details of service integration
40 | ====
41 |
42 | All the components of the gateway are connected as shown in the following figure.
43 |
44 | 
45 |
--------------------------------------------------------------------------------
/quickstarts/vertx-groovy-helloworld/src/main/java/VertxMicroservice.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 |
21 | import io.silverware.microservices.annotations.Microservice;
22 | import io.silverware.microservices.annotations.MicroserviceReference;
23 | import io.silverware.microservices.providers.cdi.MicroservicesStartedEvent;
24 |
25 | import io.vertx.core.Vertx;
26 | import io.vertx.core.logging.Logger;
27 | import io.vertx.core.logging.LoggerFactory;
28 |
29 | import javax.enterprise.event.Observes;
30 | import javax.inject.Inject;
31 |
32 | /**
33 | * @author Martin Stefanko (mstefank@redhat.com)
34 | */
35 | @Microservice("vertxMicroservice")
36 | public class VertxMicroservice {
37 |
38 | private Logger log = LoggerFactory.getLogger(VertxMicroservice.class);
39 |
40 | @Inject
41 | @MicroserviceReference
42 | private Vertx vertx;
43 |
44 |
45 | public void testVertx(@Observes MicroservicesStartedEvent event) {
46 | log.info("observer started");
47 | vertx.eventBus().consumer("silverware.topic", message -> {
48 | log.info("Received message: " + message.body());
49 | });
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/demos/devconf-2016/gateway/kjar/src/main/java/io/silverware/demos/devconf/kjar/MoodAction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.devconf.kjar;
21 |
22 | /**
23 | * @author Martin Večeřa
24 | */
25 | public class MoodAction extends Action {
26 |
27 | public enum Mood {
28 | SLEEP, ROMANTIC, EVENING, DAY
29 | }
30 |
31 | private Mood mood;
32 |
33 | public MoodAction(final Mood mood) {
34 | this.mood = mood;
35 | }
36 |
37 | public Mood getMood() {
38 | return mood;
39 | }
40 |
41 | @Override
42 | public boolean equals(final Object o) {
43 | if (this == o) {
44 | return true;
45 | }
46 | if (o == null || getClass() != o.getClass()) {
47 | return false;
48 | }
49 |
50 | final MoodAction that = (MoodAction) o;
51 |
52 | return mood == that.mood;
53 |
54 | }
55 |
56 | @Override
57 | public int hashCode() {
58 | return mood.hashCode();
59 | }
60 |
61 | @Override
62 | public String toString() {
63 | return "M" + mood.ordinal();
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/demos/devconf-2016/inteligent-home/src/main/java/io/silverware/demos/devconf2016/intelligent_home/routes/RfidRouteBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.devconf2016.intelligent_home.routes;
21 |
22 | import io.silverware.demos.devconf2016.intelligent_home.processors.RfidProcessor;
23 | import org.apache.camel.model.dataformat.JsonLibrary;
24 |
25 | /**
26 | * @author Pavel Macík
27 | */
28 | public class RfidRouteBuilder extends IntelligentHomeRouteBuilder {
29 | @Override
30 | public void configure() throws Exception {
31 | final RfidProcessor rfidProcessor = new RfidProcessor();
32 |
33 | from("timer:sensorBroadcast?period=500")
34 | .process(rfidProcessor)
35 | .to("bulldog:i2c?readLength=4")
36 | .choice()
37 | .when(body().isNotEqualTo("00000000"))
38 | .marshal().json(JsonLibrary.Jackson, true)
39 | .log("RFID tag: ${body}")
40 | .to("mqtt:status?publishTopicName=ih/message/rfidTags&userName=mqtt&password=mqtt&host=tcp://" + mqttHost() + "/");
41 | }
42 | }
--------------------------------------------------------------------------------
/demos/devconf-2016/gateway/kjar/src/main/java/io/silverware/demos/devconf/kjar/MobileButtonAction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.devconf.kjar;
21 |
22 | /**
23 | * @author Martin Večeřa
24 | */
25 | public class MobileButtonAction extends Action {
26 |
27 | private String id = "";
28 |
29 | public MobileButtonAction(final String id) {
30 | this.id = id;
31 | }
32 |
33 | public String getId() {
34 | return id;
35 | }
36 |
37 | @Override
38 | public boolean equals(final Object o) {
39 | if (this == o) {
40 | return true;
41 | }
42 | if (o == null || getClass() != o.getClass()) {
43 | return false;
44 | }
45 |
46 | final MobileButtonAction that = (MobileButtonAction) o;
47 |
48 | return id.equals(that.id);
49 |
50 | }
51 |
52 | @Override
53 | public int hashCode() {
54 | return id.hashCode();
55 | }
56 |
57 | @Override
58 | public String toString() {
59 | return "MobileButtonAction{" +
60 | "id='" + id + '\'' +
61 | '}';
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/demos/devconf-2016/gateway/kjar/src/main/java/io/silverware/demos/devconf/kjar/RfidAction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * PerfCake
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.devconf.kjar;
21 |
22 | /**
23 | * @author Martin Večeřa
24 | */
25 | public class RfidAction extends Action {
26 |
27 | private String rfid;
28 |
29 | public RfidAction(final String rfid) {
30 | this.rfid = rfid;
31 | }
32 |
33 | public String getRfid() {
34 | return rfid;
35 | }
36 |
37 | @Override
38 | public boolean equals(final Object o) {
39 | if (this == o) {
40 | return true;
41 | }
42 | if (o == null || getClass() != o.getClass()) {
43 | return false;
44 | }
45 |
46 | final RfidAction that = (RfidAction) o;
47 |
48 | return rfid != null ? rfid.equals(that.rfid) : that.rfid == null;
49 |
50 | }
51 |
52 | @Override
53 | public int hashCode() {
54 | return rfid != null ? rfid.hashCode() : 0;
55 | }
56 |
57 | @Override
58 | public String toString() {
59 | return "RfidAction{" +
60 | "rfid='" + rfid + '\'' +
61 | '}';
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/demos/devconf-2016/inteligent-home/src/main/java/io/silverware/demos/devconf2016/intelligent_home/model/SensorData.java:
--------------------------------------------------------------------------------
1 | package io.silverware.demos.devconf2016.intelligent_home.model;
2 |
3 | public class SensorData {
4 |
5 | private String sensorName = "DHT11";
6 |
7 | private int temperature = -1;
8 |
9 | private int humidity = -1;
10 |
11 | private String timestamp = "-1";
12 |
13 | // Bean methods
14 |
15 | public String getSensorName() {
16 | return this.sensorName;
17 | }
18 |
19 | public void setSensorName(String sensorName) {
20 | this.sensorName = sensorName;
21 | }
22 |
23 | public int getTemperature() {
24 | return this.temperature;
25 | }
26 |
27 | public void setTemperature(int temperature) {
28 | this.temperature = temperature;
29 | }
30 |
31 | public int getHumidity() {
32 | return this.humidity;
33 | }
34 |
35 | public void setHumidity(int humidity) {
36 | this.humidity = humidity;
37 | }
38 |
39 | public String getTimestamp() {
40 | return this.timestamp;
41 | }
42 |
43 | public void setTimestamp(String timestamp) {
44 | this.timestamp = timestamp;
45 | }
46 |
47 | // Fluent API
48 |
49 | public SensorData sensorName(String sensorName) {
50 | setSensorName(sensorName);
51 | return this;
52 | }
53 |
54 | public String sensorName() {
55 | return getSensorName();
56 | }
57 |
58 | public SensorData temperature(int temperature) {
59 | setTemperature(temperature);
60 | return this;
61 | }
62 |
63 | public int temperature() {
64 | return getTemperature();
65 | }
66 |
67 | public SensorData humidity(int humidity) {
68 | setHumidity(humidity);
69 | return this;
70 | }
71 |
72 | public int humidity() {
73 | return getHumidity();
74 | }
75 |
76 | public SensorData timestamp(String timestamp) {
77 | setTimestamp(timestamp);
78 | return this;
79 | }
80 |
81 | public String timestamp() {
82 | return getTimestamp();
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/demos/devconf-2016/inteligent-home/src/main/java/io/silverware/demos/devconf2016/intelligent_home/Pca9685Util.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.devconf2016.intelligent_home;
21 |
22 | /**
23 | * @author Pavel Macík
24 | */
25 | public final class Pca9685Util {
26 | public static int PWM_BASE_ADDRESS = 0x06;
27 |
28 | public static String pwmAddress(final int pwm) {
29 | return hex(PWM_BASE_ADDRESS + 4 * pwm);
30 | }
31 |
32 | public static String hex16bit(final int value) {
33 | final StringBuffer sb = new StringBuffer();
34 | sb.append(hex(value));
35 | sb.append(hex(value >> 8));
36 | return sb.toString();
37 | }
38 |
39 | public static String hex(final int value) {
40 | return String.format("%02X", value & 0xFF);
41 | }
42 |
43 | public static String hexMessage(final int pwm, final int value) {
44 | final StringBuffer i2cMsg = new StringBuffer();
45 | i2cMsg.append(Pca9685Util.pwmAddress(Math.max(0, Math.min(15, pwm))));
46 | i2cMsg.append(Pca9685Util.hex16bit(0)); // HIGH pulse start
47 | i2cMsg.append(Pca9685Util.hex16bit(Math.max(0, Math.min(4095, value)))); // LOW pulse end
48 | return i2cMsg.toString();
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/quickstarts/cdi-helloworld/src/main/java/io/silverware/demos/quickstarts/cdi/CdiHelloWorldMicroservice.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.quickstarts.cdi;
21 |
22 | import io.silverware.microservices.annotations.Microservice;
23 | import io.silverware.microservices.providers.cdi.MicroservicesStartedEvent;
24 | import org.apache.logging.log4j.LogManager;
25 | import org.apache.logging.log4j.Logger;
26 |
27 | import javax.annotation.PostConstruct;
28 | import javax.enterprise.event.Observes;
29 |
30 | /**
31 | * @author Martin Večeřa
32 | */
33 | @Microservice
34 | public class CdiHelloWorldMicroservice {
35 |
36 | private static final Logger log = LogManager.getLogger(CdiHelloWorldMicroservice.class);
37 |
38 | public CdiHelloWorldMicroservice() {
39 | log.info("CdiHelloWorldMicroservice constructor");
40 | }
41 |
42 | @PostConstruct
43 | public void onInit() {
44 | log.info("CdiHelloWorldMicroservice PostConstruct " + this.getClass().getName());
45 | }
46 |
47 | public void hello() {
48 | log.info("CdiHelloWorldMicroservice Hello");
49 | }
50 |
51 | public void eventObserver(@Observes final MicroservicesStartedEvent event) {
52 | log.info("CdiHelloWorldMicroservice MicroservicesStartedEvent");
53 | }
54 | }
--------------------------------------------------------------------------------
/quickstarts/openshift-base/openshift-core/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | openshift-base
7 | io.silverware.demos.quickstarts
8 | 2.1-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | openshift-core
13 | jar
14 |
15 |
16 | io.silverware
17 | microservices
18 |
19 |
20 | io.silverware
21 | cdi-microservice-provider
22 |
23 |
24 | io.silverware
25 | http-server-microservice-provider
26 |
27 |
28 |
29 |
30 | openshift
31 |
32 |
33 |
34 | io.fabric8
35 | fabric8-maven-plugin
36 | 3.2.10
37 |
38 | true
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | standalone
47 |
48 |
49 |
50 | org.apache.maven.plugins
51 | maven-dependency-plugin
52 | ${version.maven.dependency.plugin}
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/quickstarts/http-server-helloworld/README.md:
--------------------------------------------------------------------------------
1 | # Hello world http-server-microservice-provider
2 | A simple application demonstrating the use of **http-server-microservice-provider**.
3 |
4 | The application contains only one class, the `HelloworldRestService` microservice. This microservice is annotated with `javax.ws.rs` annotations, thus it will be deployed into SilverWare http server and exposed via REST.
5 |
6 | Build the application
7 | ```
8 | mvn clean package
9 | ```
10 |
11 | ##Exposing microservice without SSL
12 | Run the application
13 | ```
14 | java -jar target/rest-client-helloworld-*.jar
15 | ```
16 |
17 | Go to http://localhost:8080/silverware/rest/hello_service/hello
18 |
19 | ##Exposing microservice with SSL
20 | To protect exposed microservice via SSL, you must pass a set of SSL properties to **http-server-microservice-provider**. We will set these properties using Maven command line properties
21 |
22 |
23 |
24 | Run the application
25 | ```
26 | java -jar http-server-helloworld-2.1-SNAPSHOT.jar -Dsilverware.http.server.keystore=quickstart-server.keystore -Dsilverware.http.server.truststore=quickstart-server.truststore -Dsilverware.http.server.keystore.password=silverware -Dsilverware.http.server.truststore.password=silverware -Dsilverware.http.server.ssl.enabled=true
27 | ```
28 |
29 | You can see SSL was configured in the application logs:
30 | ```
31 | 2016-11-12 17:27:00,947 INFO {io.silverware.microservices.providers.http.HttpServerMicroserviceProvider} Property 'silverware.http.server.ssl.enable' set to 'true', enabling SSL.
32 | 2016-11-12 17:27:00,950 INFO {io.silverware.microservices.providers.http.HttpServerMicroserviceProvider} SSL configuration provided by user:
33 | 2016-11-12 17:27:00,950 INFO {io.silverware.microservices.providers.http.HttpServerMicroserviceProvider} Keystore: quickstart-server.keystore
34 | 2016-11-12 17:27:00,950 INFO {io.silverware.microservices.providers.http.HttpServerMicroserviceProvider} Truststore: quickstart-server.truststore
35 | ```
36 |
37 | Go to http://localhost:8080/silverware/rest/hello_service/hello, you will be redirected to https://localhost:10443/silverware/rest/hello_service/hello, or you can go directly to https://localhost:10443/silverware/rest/hello_service/hello
--------------------------------------------------------------------------------
/quickstarts/openshift-base/openshift-core/src/main/java/io/silverware/demos/quickstarts/openshift/cluster/api/HealthStatus.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * Silverware
4 | *
5 | * Copyright (C) 2010 - 2016 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.quickstarts.openshift.cluster.api;
21 |
22 | import io.silverware.microservices.annotations.Microservice;
23 | import io.silverware.microservices.annotations.MicroserviceReference;
24 | import io.silverware.microservices.providers.cdi.builtin.CurrentContext;
25 | import io.silverware.microservices.silver.CdiSilverService;
26 |
27 | import javax.inject.Inject;
28 | import javax.ws.rs.GET;
29 | import javax.ws.rs.Path;
30 | import javax.ws.rs.Produces;
31 | import javax.ws.rs.core.MediaType;
32 | import javax.ws.rs.core.Response;
33 |
34 | /**
35 | * This service expose health status of SilverWare
36 | *
37 | * @author Slavomír Krupa (slavomir.krupa@gmail.com)
38 | */
39 | @Microservice
40 | @Path("health")
41 | public class HealthStatus {
42 |
43 | @Inject
44 | @MicroserviceReference
45 | private CurrentContext context;
46 |
47 | @GET
48 | @Path("status")
49 | @Produces(MediaType.TEXT_PLAIN)
50 | public Response status() {
51 | final boolean isDeployed = ((CdiSilverService) this.context.getContext().getProvider(CdiSilverService.class)).isDeployed();
52 | return Response.status(isDeployed ? Response.Status.OK : Response.Status.FORBIDDEN).entity(String.valueOf(isDeployed)).build();
53 | }
54 | }
--------------------------------------------------------------------------------
/demos/openalt-2015/src/main/java/io/silverware/demos/openalt/RegisterTemperature.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.openalt;
21 |
22 | import java.util.Collections;
23 | import javax.inject.Inject;
24 |
25 | import io.silverware.microservices.annotations.Gateway;
26 | import io.silverware.microservices.annotations.Microservice;
27 | import io.silverware.microservices.annotations.MicroserviceReference;
28 | import io.silverware.microservices.providers.cdi.builtin.Storage;
29 |
30 | /**
31 | * @author Martin Večeřa
32 | */
33 | @Microservice
34 | @Gateway
35 | public class RegisterTemperature {
36 |
37 | @Inject
38 | @MicroserviceReference
39 | private ValueFilter valueFilter;
40 |
41 | @Inject
42 | @MicroserviceReference
43 | private InfluxDBWriter influxDBWriter;
44 |
45 | public void temperature(final String sensorId, final int celsius) {
46 | valueFilter.change(sensorId + ".temperature", celsius, t -> {
47 | influxDBWriter.write("sensors", "temperature", Collections.singletonMap("value", t));
48 | });
49 | }
50 |
51 | public void humidity(final String sensorId, final int relHumidity) {
52 | valueFilter.change(sensorId + ".humidity", relHumidity, h -> {
53 | influxDBWriter.write("sensors", "humidity", Collections.singletonMap("value", h));
54 | });
55 |
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/quickstarts/camel-jetty-cdi/src/main/java/io/silverware/demos/quickstarts/cdi/CamelCdiMicroservice.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.quickstarts.cdi;
21 |
22 | import io.silverware.microservices.annotations.Microservice;
23 | import io.silverware.microservices.providers.cdi.MicroservicesStartedEvent;
24 |
25 | import org.apache.logging.log4j.LogManager;
26 | import org.apache.logging.log4j.Logger;
27 |
28 | import javax.annotation.PostConstruct;
29 | import javax.enterprise.event.Observes;
30 |
31 | /**
32 | * @author Martin Večeřa
33 | */
34 | @Microservice("camelCdiMicroservice")
35 | public class CamelCdiMicroservice {
36 |
37 | private static final Logger log = LogManager.getLogger(CamelCdiMicroservice.class);
38 |
39 | public CamelCdiMicroservice() {
40 | log.info("CamelCdiMicroservice constructor");
41 | }
42 |
43 | @PostConstruct
44 | public void onInit() {
45 | log.info("CamelCdiMicroservice PostConstruct " + this.getClass().getName());
46 | }
47 |
48 | public void hello() {
49 | log.info("CamelCdiMicroservice Hello");
50 | }
51 |
52 | public String sayHello(final String msg) {
53 | return "Answering '" + msg + "' with 'How do you do!'";
54 | }
55 |
56 | public void eventObserver(@Observes MicroservicesStartedEvent event) {
57 | log.info("CamelCdiMicroservice MicroservicesStartedEvent");
58 | }
59 | }
--------------------------------------------------------------------------------
/demos/devconf-2016/gateway/kjar/src/main/java/io/silverware/demos/devconf/kjar/WeatherAction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * PerfCake
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.devconf.kjar;
21 |
22 | /**
23 | * @author Martin Večeřa
24 | */
25 | public class WeatherAction extends Action {
26 |
27 | private Weather weather;
28 |
29 | public WeatherAction(final int temperature, final int humidity) {
30 | weather = new Weather(temperature, humidity);
31 | }
32 |
33 | public WeatherAction(final Weather weather) {
34 | this.weather = weather;
35 | }
36 |
37 | public Weather getWeather() {
38 | return weather;
39 | }
40 |
41 | @Override
42 | public boolean equals(final Object o) {
43 | if (this == o) {
44 | return true;
45 | }
46 | if (o == null || getClass() != o.getClass()) {
47 | return false;
48 | }
49 |
50 | final WeatherAction that = (WeatherAction) o;
51 |
52 | return weather.equals(that.weather);
53 |
54 | }
55 |
56 | @Override
57 | public int hashCode() {
58 | return weather.hashCode();
59 | }
60 |
61 | public String getWeatherString() {
62 | return weather.getTemperature() + "°C / " + weather.getHumidity() + "%";
63 | }
64 |
65 | @Override
66 | public String toString() {
67 | return "WeatherAction{" +
68 | "weather=" + weather +
69 | '}';
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/quickstarts/camel-cdi-helloworld/src/main/java/io/silverware/demos/quickstarts/cdi/CamelCdiMicroservice.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.quickstarts.cdi;
21 |
22 | import io.silverware.microservices.annotations.Microservice;
23 | import io.silverware.microservices.providers.cdi.MicroservicesStartedEvent;
24 |
25 | import org.apache.logging.log4j.LogManager;
26 | import org.apache.logging.log4j.Logger;
27 |
28 | import javax.annotation.PostConstruct;
29 | import javax.enterprise.event.Observes;
30 |
31 | /**
32 | * @author Martin Večeřa
33 | */
34 | @Microservice("camelCdiMicroservice")
35 | public class CamelCdiMicroservice {
36 |
37 | private static final Logger log = LogManager.getLogger(CamelCdiMicroservice.class);
38 |
39 | public CamelCdiMicroservice() {
40 | log.info("CamelCdiMicroservice constructor");
41 | }
42 |
43 | @PostConstruct
44 | public void onInit() {
45 | log.info("CamelCdiMicroservice PostConstruct " + this.getClass().getName());
46 | }
47 |
48 | public void hello() {
49 | log.info("CamelCdiMicroservice Hello");
50 | }
51 |
52 | public String sayHello(final String msg) {
53 | return "Answering '" + msg + "' with 'How do you do!'";
54 | }
55 |
56 | public void eventObserver(@Observes MicroservicesStartedEvent event) {
57 | log.info("CamelCdiMicroservice MicroservicesStartedEvent");
58 | }
59 | }
--------------------------------------------------------------------------------
/demos/devconf-2016/gateway/app/src/main/java/io/silverware/demos/devconf/drools/MobileGatewayMicroservice.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.devconf.drools;
21 |
22 | import org.apache.camel.ProducerTemplate;
23 | import org.apache.logging.log4j.LogManager;
24 | import org.apache.logging.log4j.Logger;
25 |
26 | import javax.inject.Inject;
27 |
28 | import io.silverware.demos.devconf.kjar.MobileButtonAction;
29 | import io.silverware.microservices.annotations.Microservice;
30 | import io.silverware.microservices.annotations.MicroserviceReference;
31 | import io.silverware.microservices.annotations.ParamName;
32 |
33 | /**
34 | * Processes a mobile phone button event and creates the corresponding action on the action message topic.
35 | *
36 | * @author Martin Večeřa
37 | */
38 | @Microservice
39 | public class MobileGatewayMicroservice {
40 |
41 | private static final Logger log = LogManager.getLogger(MobileGatewayMicroservice.class);
42 |
43 | @Inject
44 | @MicroserviceReference
45 | private ProducerTemplate producer;
46 |
47 | public MobileGatewayMicroservice() {
48 | log.info("MobileGatewayMicroservice constructor");
49 | }
50 |
51 | public void mobileAction(@ParamName("button") final String button) {
52 | log.info("Mobile phone button {}", button);
53 | producer.sendBody("direct:actions", new MobileButtonAction(button));
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/demos/openalt-2015/src/main/java/io/silverware/demos/openalt/InfluxDBWriter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.openalt;
21 |
22 | import org.influxdb.InfluxDB;
23 | import org.influxdb.InfluxDBFactory;
24 | import org.influxdb.dto.Point;
25 |
26 | import java.util.Map;
27 | import javax.inject.Inject;
28 |
29 | import io.silverware.microservices.annotations.Microservice;
30 | import io.silverware.microservices.annotations.MicroserviceReference;
31 | import io.silverware.microservices.providers.cdi.builtin.Configuration;
32 |
33 | /**
34 | * @author Martin Večeřa
35 | */
36 | @Microservice
37 | public class InfluxDBWriter {
38 |
39 | public static final String INFLUXDB_URL = "influxdb.url";
40 | public static final String INFLUXDB_USER = "influxdb.user";
41 | public static final String INFLUXDB_PASSWORD = "influxdb.password";
42 |
43 | @Inject
44 | @MicroserviceReference
45 | private Configuration configuration;
46 |
47 | public void write(final String dbName, final String measurement, final Map fields) {
48 | InfluxDB influxDB = InfluxDBFactory.connect((String) configuration.getProperty(INFLUXDB_URL), (String) configuration.getProperty(INFLUXDB_USER), (String) configuration.getProperty(INFLUXDB_PASSWORD));
49 | Point p = Point.measurement(measurement).fields(fields).build();
50 | influxDB.write(dbName, "default", p);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/demos/devconf-2016/gateway/kjar/src/main/java/io/silverware/demos/devconf/kjar/FireplaceCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.devconf.kjar;
21 |
22 | import java.util.Collections;
23 | import java.util.Map;
24 |
25 | /**
26 | * @author Martin Večeřa
27 | */
28 | public class FireplaceCommand extends Command {
29 |
30 | public enum Fire {
31 | HEAT, COLD
32 | }
33 |
34 | private Fire fire = Fire.COLD;
35 |
36 | public FireplaceCommand(final Fire fire) {
37 | this.fire = fire;
38 | }
39 |
40 | public Fire getFire() {
41 | return fire;
42 | }
43 |
44 | @Override
45 | public boolean equals(final Object o) {
46 | if (this == o) {
47 | return true;
48 | }
49 | if (o == null || getClass() != o.getClass()) {
50 | return false;
51 | }
52 |
53 | final FireplaceCommand that = (FireplaceCommand) o;
54 |
55 | return fire == that.fire;
56 |
57 | }
58 |
59 | @Override
60 | public int hashCode() {
61 | return fire.hashCode();
62 | }
63 |
64 | @Override
65 | public String toString() {
66 | return "FireplaceCommand{" +
67 | "fire=" + fire +
68 | '}';
69 | }
70 |
71 | @Override
72 | public Map getCacheUpdate() {
73 | return Collections.singletonMap(this.getClass().getCanonicalName(), fire.toString());
74 | }
75 |
76 | }
77 |
--------------------------------------------------------------------------------
/demos/devconf-2016/gateway/kjar/src/main/java/io/silverware/demos/devconf/kjar/AirConditioningCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.devconf.kjar;
21 |
22 | import java.util.Collections;
23 | import java.util.Map;
24 |
25 | /**
26 | * @author Martin Večeřa
27 | */
28 | public class AirConditioningCommand extends Command {
29 |
30 | public enum Ac {
31 | COOLING, NORMAL
32 | }
33 |
34 | private Ac ac = Ac.NORMAL;
35 |
36 | public AirConditioningCommand(final Ac ac) {
37 | this.ac = ac;
38 | }
39 |
40 | public Ac getAc() {
41 | return ac;
42 | }
43 |
44 | @Override
45 | public boolean equals(final Object o) {
46 | if (this == o) {
47 | return true;
48 | }
49 | if (o == null || getClass() != o.getClass()) {
50 | return false;
51 | }
52 |
53 | final AirConditioningCommand that = (AirConditioningCommand) o;
54 |
55 | return ac == that.ac;
56 |
57 | }
58 |
59 | @Override
60 | public int hashCode() {
61 | return ac.hashCode();
62 | }
63 |
64 | @Override
65 | public String toString() {
66 | return "AirConditioningCommand{" +
67 | "ac=" + ac +
68 | '}';
69 | }
70 |
71 | @Override
72 | public Map getCacheUpdate() {
73 | return Collections.singletonMap(this.getClass().getCanonicalName(), ac.toString());
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/demos/devconf-2016/inteligent-home/src/main/java/io/silverware/demos/devconf2016/intelligent_home/routes/SensorRouteBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.devconf2016.intelligent_home.routes;
21 |
22 | import org.apache.camel.model.dataformat.JsonLibrary;
23 |
24 | import io.silverware.demos.devconf2016.intelligent_home.processors.SensorDataProcessor;
25 |
26 | /**
27 | * @author Pavel Macík
28 | */
29 | public class SensorRouteBuilder extends IntelligentHomeRouteBuilder {
30 |
31 | @Override
32 | public void configure() throws Exception {
33 | final SensorDataProcessor sensorDataProcessor = new SensorDataProcessor();
34 |
35 | from(restBaseUri() + "/sensorData?httpMethodRestrict=GET")
36 | .setHeader("address", simple(config.getSensorAddress()))
37 | .setBody(simple(""))
38 | .to("bulldog:i2c?readLength=2")
39 | .process(sensorDataProcessor)
40 | .marshal().json(JsonLibrary.Jackson, true);
41 |
42 | from("timer:sensorBroadcast?period=5000")
43 | .setHeader("address", simple(config.getSensorAddress()))
44 | .to("bulldog:i2c?readLength=2")
45 | .process(sensorDataProcessor)
46 | .marshal().json(JsonLibrary.Jackson, true)
47 | .to("mqtt:status?publishTopicName=ih/message/weather&userName=mqtt&password=mqtt&host=tcp://" + mqttHost() + "/");
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/quickstarts/openshift-base/openshift-cluster-worker/src/main/java/io/silverware/demos/quickstarts/openshift/cluster/api/WorkerOld.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * Silverware
4 | *
5 | * Copyright (C) 2010 - 2016 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.quickstarts.openshift.cluster.api;
21 |
22 | import static io.silverware.demos.quickstarts.openshift.cluster.api.WorkerInterface.VERSION_1;
23 |
24 | import io.silverware.microservices.annotations.Microservice;
25 | import io.silverware.microservices.annotations.MicroserviceVersion;
26 |
27 | import org.apache.logging.log4j.LogManager;
28 | import org.apache.logging.log4j.Logger;
29 |
30 | /**
31 | * Older implementation of worker.
32 | *
33 | * NOTE: Do not mix multiple version of services in same project.
34 | *
35 | * @author Slavomír Krupa (slavomir.krupa@gmail.com)
36 | */
37 | @Microservice
38 | @MicroserviceVersion(api = VERSION_1)
39 | public class WorkerOld implements WorkerInterface {
40 |
41 | private static final Logger log = LogManager.getLogger(WorkerOld.class);
42 |
43 | @Override
44 | public String callHello() {
45 | log.info("Hello!");
46 | return HELLO;
47 |
48 | }
49 |
50 | @Override
51 | public String getVersion() {
52 | return VERSION_1;
53 | }
54 |
55 | @Override
56 | public CustomObject customSerialization(final CustomObject customObject) {
57 | CustomObject result = CustomObject.randomObject();
58 | log.info("Received: {} returning: {} ", customObject, result);
59 | return result;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/demos/devconf-2016/gateway/kjar/src/main/java/io/silverware/demos/devconf/kjar/MediaCenterCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.devconf.kjar;
21 |
22 | import java.util.Collections;
23 | import java.util.Map;
24 |
25 | /**
26 | * @author Martin Večeřa
27 | */
28 | public class MediaCenterCommand extends Command {
29 |
30 | public enum Media {
31 | OFF, ROMANCE, NEWS
32 | }
33 |
34 | private Media media = Media.OFF;
35 |
36 | public MediaCenterCommand(final Media media) {
37 | this.media = media;
38 | }
39 |
40 | public Media getMedia() {
41 | return media;
42 | }
43 |
44 | @Override
45 | public boolean equals(final Object o) {
46 | if (this == o) {
47 | return true;
48 | }
49 | if (o == null || getClass() != o.getClass()) {
50 | return false;
51 | }
52 |
53 | final MediaCenterCommand that = (MediaCenterCommand) o;
54 |
55 | return media == that.media;
56 |
57 | }
58 |
59 | @Override
60 | public int hashCode() {
61 | return media.hashCode();
62 | }
63 |
64 | @Override
65 | public String toString() {
66 | return "MediaCenterCommand{" +
67 | "media=" + media +
68 | '}';
69 | }
70 |
71 | @Override
72 | public Map getCacheUpdate() {
73 | return Collections.singletonMap(this.getClass().getCanonicalName(), media.toString());
74 | }
75 |
76 | }
77 |
--------------------------------------------------------------------------------
/quickstarts/openshift-base/openshift-cluster-worker/src/main/java/io/silverware/demos/quickstarts/openshift/cluster/api/WorkerNew.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * Silverware
4 | *
5 | * Copyright (C) 2010 - 2016 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.quickstarts.openshift.cluster.api;
21 |
22 | import static io.silverware.demos.quickstarts.openshift.cluster.api.WorkerInterface.VERSION_2;
23 |
24 | import io.silverware.microservices.annotations.Microservice;
25 | import io.silverware.microservices.annotations.MicroserviceVersion;
26 |
27 | import org.apache.logging.log4j.LogManager;
28 | import org.apache.logging.log4j.Logger;
29 |
30 | /**
31 | * Newer implementation of worker.
32 | *
33 | * NOTE: Do not mix multiple version of services in same project.
34 | * In this project it is done just for minimalization of example.
35 | *
36 | * @author Slavomír Krupa (slavomir.krupa@gmail.com)
37 | */
38 | @Microservice
39 | @MicroserviceVersion(api = VERSION_2)
40 | public class WorkerNew implements WorkerInterface {
41 |
42 | private static final Logger log = LogManager.getLogger(WorkerNew.class);
43 |
44 | @Override
45 | public String callHello() {
46 | log.info("Hello!");
47 | return HELLO;
48 |
49 | }
50 |
51 | @Override
52 | public String getVersion() {
53 | return VERSION_2;
54 | }
55 |
56 | @Override
57 | public CustomObject customSerialization(final CustomObject customObject) {
58 | log.info("Received and returning same object {} ", customObject);
59 | return customObject;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/demos/devconf-2016/inteligent-home/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 | io.silverware.demos
5 | demos-parent
6 | 2.0-SNAPSHOT
7 | ../../pom.xml
8 |
9 | devconf-2016-inteligent-home
10 | jar
11 |
12 | 0.3.0-SNAPSHOT
13 |
14 |
15 |
16 | io.silverware
17 | microservices
18 |
19 |
20 | io.silverware
21 | camel-microservice-provider
22 |
23 |
24 | org.apache.camel
25 | camel-jetty
26 | ${version.apache.camel}
27 |
28 |
29 | org.apache.camel
30 | camel-mqtt
31 | ${version.apache.camel}
32 |
33 |
34 | org.apache.camel
35 | camel-jackson
36 | ${version.apache.camel}
37 |
38 |
39 | io.silverspoon
40 | camel-bulldog
41 | ${version.silverspoon}
42 |
43 |
44 | org.testng
45 | testng
46 | test
47 |
48 |
49 |
50 |
51 |
52 | org.apache.maven.plugins
53 | maven-dependency-plugin
54 | ${version.maven.dependency.plugin}
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/quickstarts/drools-helloworld/app/src/main/java/io/silverware/demos/quickstarts/drools/DroolsHelloWorldMicroservice.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.quickstarts.drools;
21 |
22 | import io.silverware.microservices.annotations.Microservice;
23 | import io.silverware.microservices.annotations.MicroserviceReference;
24 | import io.silverware.microservices.providers.cdi.MicroservicesStartedEvent;
25 |
26 | import org.apache.logging.log4j.LogManager;
27 | import org.apache.logging.log4j.Logger;
28 | import org.kie.api.cdi.KSession;
29 | import org.kie.api.runtime.KieSession;
30 |
31 | import javax.annotation.PostConstruct;
32 | import javax.enterprise.event.Observes;
33 | import javax.inject.Inject;
34 |
35 | /**
36 | * @author Martin Večeřa
37 | */
38 | @Microservice
39 | public class DroolsHelloWorldMicroservice {
40 |
41 | private static final Logger log = LogManager.getLogger(DroolsHelloWorldMicroservice.class);
42 |
43 | @Inject
44 | @KSession
45 | private KieSession session;
46 |
47 | public DroolsHelloWorldMicroservice() {
48 | log.info("DroolsHelloWorldMicroservice constructor");
49 | }
50 |
51 | public void eventObserver(@Observes MicroservicesStartedEvent event) {
52 | log.info("DroolsHelloWorldMicroservice MicroservicesStartedEvent {}", session);
53 | if (session != null) {
54 | session.insert("test");
55 | session.fireAllRules();
56 | log.info("Fired!");
57 | }
58 | }
59 | }
--------------------------------------------------------------------------------
/demos/devconf-2016/gateway/kjar/src/main/java/io/silverware/demos/devconf/kjar/Weather.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.devconf.kjar;
21 |
22 | import java.io.Serializable;
23 |
24 | /**
25 | * @author Martin Večeřa
26 | */
27 | public class Weather implements Serializable {
28 |
29 | private int temperature;
30 | private int humidity;
31 |
32 | public Weather(final int temperature, final int humidity) {
33 | this.temperature = temperature;
34 | this.humidity = humidity;
35 | }
36 |
37 | public int getTemperature() {
38 | return temperature;
39 | }
40 |
41 | public int getHumidity() {
42 | return humidity;
43 | }
44 |
45 | @Override
46 | public boolean equals(final Object o) {
47 | if (this == o) {
48 | return true;
49 | }
50 | if (o == null || getClass() != o.getClass()) {
51 | return false;
52 | }
53 |
54 | final Weather that = (Weather) o;
55 |
56 | if (temperature != that.temperature) {
57 | return false;
58 | }
59 | return humidity == that.humidity;
60 |
61 | }
62 |
63 | @Override
64 | public int hashCode() {
65 | int result = temperature;
66 | result = 31 * result + humidity;
67 | return result;
68 | }
69 |
70 | @Override
71 | public String toString() {
72 | return "Weather{" +
73 | "temperature=" + temperature +
74 | ", humidity=" + humidity +
75 | '}';
76 | }
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/demos/devconf-2016/gateway/kjar/src/main/java/io/silverware/demos/devconf/kjar/CacheStatus.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2014 - 2016 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.devconf.kjar;
21 |
22 | /**
23 | * @author Martin Večeřa
24 | */
25 | public class CacheStatus {
26 |
27 | private final String key;
28 | private final String value;
29 |
30 | public CacheStatus(final String key, final String value) {
31 | this.key = key;
32 | this.value = value;
33 | }
34 |
35 | public String getKey() {
36 | return key;
37 | }
38 |
39 | public String getValue() {
40 | return value;
41 | }
42 |
43 | @Override
44 | public boolean equals(final Object o) {
45 | if (this == o) {
46 | return true;
47 | }
48 | if (o == null || getClass() != o.getClass()) {
49 | return false;
50 | }
51 |
52 | final CacheStatus that = (CacheStatus) o;
53 |
54 | if (key != null ? !key.equals(that.key) : that.key != null) {
55 | return false;
56 | }
57 | return value != null ? value.equals(that.value) : that.value == null;
58 |
59 | }
60 |
61 | @Override
62 | public int hashCode() {
63 | int result = key != null ? key.hashCode() : 0;
64 | result = 31 * result + (value != null ? value.hashCode() : 0);
65 | return result;
66 | }
67 |
68 | @Override
69 | public String toString() {
70 | return "CacheStatus{" +
71 | "key='" + key + '\'' +
72 | ", value='" + value + '\'' +
73 | '}';
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/demos/devconf-2016/inteligent-home/src/main/java/io/silverware/demos/devconf2016/intelligent_home/processors/SensorDataProcessor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.devconf2016.intelligent_home.processors;
21 |
22 | import org.apache.camel.Exchange;
23 | import org.apache.camel.Message;
24 | import org.apache.camel.Processor;
25 |
26 | import java.text.SimpleDateFormat;
27 | import java.util.Date;
28 |
29 | import io.silverware.demos.devconf2016.intelligent_home.Configuration;
30 | import io.silverware.demos.devconf2016.intelligent_home.model.SensorData;
31 |
32 | /**
33 | * @author Pavel Macík
34 | */
35 | public class SensorDataProcessor implements Processor {
36 | private Configuration config = Configuration.getInstance();
37 | private static final SimpleDateFormat TIMESTAMP_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
38 | private static final String SENSOR_NAME = "LivingRoom";
39 |
40 | // input headers led=led number; channel=r, g or b; r=red value; g=green value; b=blue value;
41 | @Override
42 | public void process(final Exchange exchange) throws Exception {
43 |
44 | final Message in = exchange.getIn();
45 | final String body = (String) in.getBody();
46 | final SensorData sensorData = new SensorData();
47 | sensorData
48 | .sensorName(SENSOR_NAME)
49 | .temperature(Byte.decode("0x" + body.substring(0, 2)))
50 | .humidity(Byte.decode("0x" + body.substring(2, 4)))
51 | .timestamp(TIMESTAMP_FORMAT.format(new Date()));
52 | in.setBody(sensorData);
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/demos/devconf-2016/inteligent-home/src/main/java/io/silverware/demos/devconf2016/intelligent_home/routes/RgbLedRouteBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.devconf2016.intelligent_home.routes;
21 |
22 | import io.silverware.demos.devconf2016.intelligent_home.processors.RgbLedBatchProcessor;
23 |
24 | /**
25 | * @author Pavel Macík
26 | */
27 | public class RgbLedRouteBuilder extends IntelligentHomeRouteBuilder {
28 | @Override
29 | public void configure() throws Exception {
30 | final RgbLedBatchProcessor rgbLedBatchProcessor = new RgbLedBatchProcessor();
31 |
32 | // direct routes
33 | from("direct:led-set-batch")
34 | .process(rgbLedBatchProcessor)
35 | .to("direct:pca9685-pwm-set-batch");
36 |
37 | // REST API routes
38 | from(restBaseUri() + "/led/batch?httpMethodRestrict=POST")
39 | .to("direct:led-set-batch");
40 |
41 | from(restBaseUri() + "/led/setrgb?httpMethodRestrict=GET")
42 | .setBody(simple("${header.led};r;${header.r}\n"
43 | + "${header.led};g;${header.g}\n"
44 | + "${header.led};b;${header.b}\n"
45 | ))
46 | .to("direct:led-set-batch");
47 |
48 | final String allLed = Integer.toString(0xFFFF);
49 | from(restBaseUri() + "/led/setrgb/all?httpMethodRestrict=GET")
50 | .setBody(simple(allLed + ";r;${header.r}\n"
51 | + allLed + ";g;${header.g}\n"
52 | + allLed + ";b;${header.b}\n"
53 | ))
54 | .to("direct:led-set-batch");
55 | }
56 | }
--------------------------------------------------------------------------------
/demos/devconf-2016/inteligent-home/src/main/java/io/silverware/demos/devconf2016/intelligent_home/processors/Pca9685PwmSetProcessor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.devconf2016.intelligent_home.processors;
21 |
22 | import org.apache.camel.Exchange;
23 | import org.apache.camel.Message;
24 | import org.apache.camel.Processor;
25 | import org.apache.log4j.Logger;
26 |
27 | import io.silverware.demos.devconf2016.intelligent_home.routes.Pca9685RouteBuilder;
28 | import io.silverware.demos.devconf2016.intelligent_home.Pca9685Util;
29 |
30 | /**
31 | * @author Pavel Macík
32 | */
33 | public class Pca9685PwmSetProcessor implements Processor {
34 | private static final Logger log = Logger.getLogger(Pca9685PwmSetProcessor.class);
35 |
36 | @Override
37 | public void process(final Exchange exchange) throws Exception {
38 | Message msg = exchange.getIn();
39 | final Object pwmHeader = msg.getHeader(Pca9685RouteBuilder.PWM_HEADER);
40 | if (pwmHeader == null) {
41 | throw new RuntimeException("'pwm' header not found! Value 0 - 15 expected.");
42 | }
43 | // bound value to 0-4095 range
44 | final Object valueHeader = msg.getHeader(Pca9685RouteBuilder.VALUE_HEADER);
45 | if (valueHeader == null) {
46 | throw new RuntimeException("'value' header not found! Value 0 - 4095 expected.");
47 | }
48 | String i2cMsg = Pca9685Util.hexMessage(Integer.valueOf(pwmHeader.toString()), Integer.valueOf(valueHeader.toString()));
49 |
50 | if (log.isDebugEnabled()) {
51 | log.debug("Sending I2C message: " + i2cMsg);
52 | }
53 | msg.setBody(i2cMsg);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/demos/devconf-2016/gateway/kjar/src/main/java/io/silverware/demos/devconf/kjar/LedState.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.devconf.kjar;
21 |
22 | import java.io.Serializable;
23 |
24 | /**
25 | * @author Martin Večeřa
26 | */
27 | public class LedState implements Serializable {
28 |
29 | public static final LedState OFF = new LedState(0, 0, 0);
30 | public static final LedState ON = new LedState(100, 100, 100);
31 |
32 | private int r, g, b;
33 |
34 | public LedState(final int r, final int g, final int b) {
35 | this.r = r;
36 | this.g = g;
37 | this.b = b;
38 | }
39 |
40 | public int getR() {
41 | return r;
42 | }
43 |
44 | public int getG() {
45 | return g;
46 | }
47 |
48 | public int getB() {
49 | return b;
50 | }
51 |
52 | @Override
53 | public boolean equals(final Object o) {
54 | if (this == o) {
55 | return true;
56 | }
57 | if (o == null || getClass() != o.getClass()) {
58 | return false;
59 | }
60 |
61 | final LedState ledState = (LedState) o;
62 |
63 | if (r != ledState.r) {
64 | return false;
65 | }
66 | if (g != ledState.g) {
67 | return false;
68 | }
69 | return b == ledState.b;
70 |
71 | }
72 |
73 | @Override
74 | public int hashCode() {
75 | int result = r;
76 | result = 31 * result + g;
77 | result = 31 * result + b;
78 | return result;
79 | }
80 |
81 | @Override
82 | public String toString() {
83 | return "LedState{" +
84 | "r=" + r +
85 | ", g=" + g +
86 | ", b=" + b +
87 | '}';
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/demos/devconf-2016/inteligent-home/src/main/java/io/silverware/demos/devconf2016/intelligent_home/processors/RgbLedProcessor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -----------------------------------------------------------------------\
3 | * SilverWare
4 | *
5 | * Copyright (C) 2010 - 2013 the original author or authors.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * -----------------------------------------------------------------------/
19 | */
20 | package io.silverware.demos.devconf2016.intelligent_home.processors;
21 |
22 | import org.apache.camel.Exchange;
23 | import org.apache.camel.Message;
24 | import org.apache.camel.Processor;
25 |
26 | import io.silverware.demos.devconf2016.intelligent_home.Configuration;
27 | import io.silverware.demos.devconf2016.intelligent_home.routes.Pca9685RouteBuilder;
28 |
29 | /**
30 | * @author Pavel Macík
31 | */
32 | public class RgbLedProcessor implements Processor {
33 | private Configuration config = Configuration.getInstance();
34 |
35 | // input headers led=led number; channel=r, g or b; r=red value; g=green value; b=blue value;
36 | @Override
37 | public void process(final Exchange exchange) throws Exception {
38 | final Message in = exchange.getIn();
39 | final int led = Integer.valueOf(in.getHeader("led").toString()); // 0-15
40 | final String channel = in.getHeader("channel").toString(); // one of 'r', 'g' or 'b'
41 | final String value = in.getHeader("value").toString(); // 0-100 [%]
42 |
43 | final String pca9685Address = config.getRgbLedPca9685Address(led, channel);
44 | if (pca9685Address == null) {
45 | throw new IllegalArgumentException("The address of PCA9685 for LED #" + led + " is invalid or not defined in " + Configuration.CONFIG_FILE);
46 | }
47 | in.setHeader("address", pca9685Address);
48 | in.setHeader(Pca9685RouteBuilder.PWM_HEADER, config.getRgbLedPwm(led, channel));
49 | in.setHeader(Pca9685RouteBuilder.VALUE_HEADER, (int) (40.95 * Integer.valueOf(value)));
50 | }
51 | }
52 |
--------------------------------------------------------------------------------