First working version
This commit is contained in:
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
generated/
|
||||
bin/
|
||||
*.iml
|
||||
.idea/
|
||||
cnf/cache/
|
||||
10
cnf/build.bnd
Normal file
10
cnf/build.bnd
Normal file
@@ -0,0 +1,10 @@
|
||||
-plugin.projectDeps: \
|
||||
aQute.bnd.repository.maven.provider.MavenBndRepository; \
|
||||
releaseUrl=https://repo.maven.apache.org/maven2/; \
|
||||
index=${build}/dependencies.maven; \
|
||||
name=Maven dependencies
|
||||
|
||||
-plugin.amdatuRemoteREp:\
|
||||
aQute.bnd.repository.osgi.OSGiRepository; \
|
||||
name=Amdatu remote; \
|
||||
locations=${fileuri;cnf/localrepo/index.xml}
|
||||
29
cnf/dependencies.maven
Normal file
29
cnf/dependencies.maven
Normal file
@@ -0,0 +1,29 @@
|
||||
org.osgi:osgi.core:8.0.0
|
||||
org.osgi:org.osgi.annotation:6.0.0
|
||||
org.osgi:org.osgi.service.component:1.4.0
|
||||
org.osgi:org.osgi.service.component.annotations:1.4.0
|
||||
org.osgi:org.osgi.util.promise:1.1.1
|
||||
org.osgi:org.osgi.util.function:1.1.0
|
||||
|
||||
org.apache.felix:org.apache.felix.framework:7.0.1
|
||||
|
||||
org.apache.felix:org.apache.felix.gogo.command:1.1.2
|
||||
org.apache.felix:org.apache.felix.gogo.runtime:1.1.4
|
||||
org.apache.felix:org.apache.felix.gogo.shell:1.1.4
|
||||
|
||||
org.apache.felix:org.apache.felix.scr:2.1.28
|
||||
|
||||
org.apache.felix:org.apache.felix.configadmin:1.9.22
|
||||
org.apache.felix:org.apache.felix.configurator:1.0.14
|
||||
org.apache.felix:org.apache.felix.cm.json:1.0.6
|
||||
org.apache.sling:org.apache.sling.commons.johnzon:1.2.6
|
||||
org.apache.felix:org.apache.felix.converter:1.0.18
|
||||
|
||||
org.apache.felix:org.apache.felix.log:1.2.4
|
||||
|
||||
org.apache.felix:org.apache.felix.eventadmin:1.6.2
|
||||
org.apache.felix:org.apache.felix.metatype:1.2.4
|
||||
org.apache.felix:org.apache.felix.dependencymanager:3.2.0
|
||||
org.apache.felix:org.apache.felix.http.servlet-api:1.1.2
|
||||
org.apache.felix:org.apache.felix.http.jetty:4.1.12
|
||||
org.osgi:org.osgi.service.remoteserviceadmin:1.1.0
|
||||
238
cnf/localrepo/index.xml
Normal file
238
cnf/localrepo/index.xml
Normal file
@@ -0,0 +1,238 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<repository xmlns="http://www.osgi.org/xmlns/repository/v1.0.0">
|
||||
<resource>
|
||||
<capability namespace="osgi.identity">
|
||||
<attribute name="license" value="http://www.opensource.org/licenses/apache2.0.php;description="Apache 2.0 Licensed";link=LICENSE"/>
|
||||
<attribute name="osgi.identity" value="org.amdatu.remote.discovery.configured"/>
|
||||
<attribute name="type" value="osgi.bundle"/>
|
||||
<attribute name="version" value="0.1.3" type="Version"/>
|
||||
</capability>
|
||||
<capability namespace="osgi.wiring.bundle">
|
||||
<attribute name="bundle-version" value="0.1.3" type="Version"/>
|
||||
<attribute name="osgi.wiring.bundle" value="org.amdatu.remote.discovery.configured"/>
|
||||
</capability>
|
||||
<capability namespace="osgi.wiring.host">
|
||||
<attribute name="bundle-version" value="0.1.3" type="Version"/>
|
||||
<attribute name="osgi.wiring.host" value="org.amdatu.remote.discovery.configured"/>
|
||||
</capability>
|
||||
<capability namespace="osgi.content">
|
||||
<attribute name="size" value="424148" type="Long"/>
|
||||
<attribute name="url" value="org.amdatu.remote.discovery.configured-0.1.3.jar"/>
|
||||
<attribute name="mime" value="application/vnd.osgi.bundle"/>
|
||||
<attribute name="osgi.content" value="7525B80760A34E1BBB40805F5F8ADB4F272B97A6AD9286E41399AAA9467D4903"/>
|
||||
</capability>
|
||||
<capability namespace="osgi.remoteserviceadmin.discovery">
|
||||
<attribute name="protocols" value="configured" type="List<String>"/>
|
||||
<attribute name="version" value="1.1.0" type="Version"/>
|
||||
</capability>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(&(osgi.wiring.package=javax.servlet)(version>=2.6.0)(!(version>=3.0.0)))"/>
|
||||
<attribute name="osgi.wiring.package" value="javax.servlet"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(&(osgi.wiring.package=javax.servlet.http)(version>=2.6.0)(!(version>=3.0.0)))"/>
|
||||
<attribute name="osgi.wiring.package" value="javax.servlet.http"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(osgi.wiring.package=javax.xml.parsers)"/>
|
||||
<attribute name="osgi.wiring.package" value="javax.xml.parsers"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(&(osgi.wiring.package=org.apache.felix.dm)(version>=3.0.0)(!(version>=4.0.0)))"/>
|
||||
<attribute name="osgi.wiring.package" value="org.apache.felix.dm"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(&(osgi.wiring.package=org.osgi.framework)(version>=1.7.0)(!(version>=2.0.0)))"/>
|
||||
<attribute name="osgi.wiring.package" value="org.osgi.framework"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(&(osgi.wiring.package=org.osgi.service.cm)(version>=1.5.0)(!(version>=2.0.0)))"/>
|
||||
<attribute name="osgi.wiring.package" value="org.osgi.service.cm"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(&(osgi.wiring.package=org.osgi.service.http)(version>=1.2.0)(!(version>=2.0.0)))"/>
|
||||
<attribute name="osgi.wiring.package" value="org.osgi.service.http"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(&(osgi.wiring.package=org.osgi.service.log)(version>=1.3.0)(!(version>=2.0.0)))"/>
|
||||
<attribute name="osgi.wiring.package" value="org.osgi.service.log"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(&(osgi.wiring.package=org.osgi.service.remoteserviceadmin)(version>=1.1.0)(!(version>=2.0.0)))"/>
|
||||
<attribute name="osgi.wiring.package" value="org.osgi.service.remoteserviceadmin"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(osgi.wiring.package=org.xml.sax)"/>
|
||||
<attribute name="osgi.wiring.package" value="org.xml.sax"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(osgi.wiring.package=org.xml.sax.helpers)"/>
|
||||
<attribute name="osgi.wiring.package" value="org.xml.sax.helpers"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.ee">
|
||||
<directive name="filter" value="(&(osgi.ee=JavaSE)(version=1.7))"/>
|
||||
</requirement>
|
||||
</resource>
|
||||
<resource>
|
||||
<capability namespace="osgi.identity">
|
||||
<attribute name="license" value="http://www.opensource.org/licenses/apache2.0.php;description="Apache 2.0 Licensed";link=LICENSE"/>
|
||||
<attribute name="osgi.identity" value="org.amdatu.remote.topology.promiscuous"/>
|
||||
<attribute name="type" value="osgi.bundle"/>
|
||||
<attribute name="version" value="0.1.3" type="Version"/>
|
||||
</capability>
|
||||
<capability namespace="osgi.wiring.bundle">
|
||||
<attribute name="bundle-version" value="0.1.3" type="Version"/>
|
||||
<attribute name="osgi.wiring.bundle" value="org.amdatu.remote.topology.promiscuous"/>
|
||||
</capability>
|
||||
<capability namespace="osgi.wiring.host">
|
||||
<attribute name="bundle-version" value="0.1.3" type="Version"/>
|
||||
<attribute name="osgi.wiring.host" value="org.amdatu.remote.topology.promiscuous"/>
|
||||
</capability>
|
||||
<capability namespace="osgi.content">
|
||||
<attribute name="size" value="406405" type="Long"/>
|
||||
<attribute name="url" value="org.amdatu.remote.topology.promiscuous-0.1.3.jar"/>
|
||||
<attribute name="mime" value="application/vnd.osgi.bundle"/>
|
||||
<attribute name="osgi.content" value="61738F7B04EFAD7E083B96D38CEF1DE40EE958A00F1A8ECA2F2CE516C3EB7B55"/>
|
||||
</capability>
|
||||
<capability namespace="osgi.remoteserviceadmin.topology">
|
||||
<attribute name="version" value="1.1.0" type="Version"/>
|
||||
<attribute name="policy" value="promiscuous" type="List<String>"/>
|
||||
</capability>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(osgi.wiring.package=javax.xml.parsers)"/>
|
||||
<attribute name="osgi.wiring.package" value="javax.xml.parsers"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(&(osgi.wiring.package=org.apache.felix.dm)(version>=3.0.0)(!(version>=4.0.0)))"/>
|
||||
<attribute name="osgi.wiring.package" value="org.apache.felix.dm"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(&(osgi.wiring.package=org.osgi.framework)(version>=1.7.0)(!(version>=2.0.0)))"/>
|
||||
<attribute name="osgi.wiring.package" value="org.osgi.framework"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(&(osgi.wiring.package=org.osgi.service.cm)(version>=1.5.0)(!(version>=2.0.0)))"/>
|
||||
<attribute name="osgi.wiring.package" value="org.osgi.service.cm"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(&(osgi.wiring.package=org.osgi.service.log)(version>=1.3.0)(!(version>=2.0.0)))"/>
|
||||
<attribute name="osgi.wiring.package" value="org.osgi.service.log"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(&(osgi.wiring.package=org.osgi.service.remoteserviceadmin)(version>=1.1.0)(!(version>=2.0.0)))"/>
|
||||
<attribute name="osgi.wiring.package" value="org.osgi.service.remoteserviceadmin"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(osgi.wiring.package=org.xml.sax)"/>
|
||||
<attribute name="osgi.wiring.package" value="org.xml.sax"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(osgi.wiring.package=org.xml.sax.helpers)"/>
|
||||
<attribute name="osgi.wiring.package" value="org.xml.sax.helpers"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.ee">
|
||||
<directive name="filter" value="(&(osgi.ee=JavaSE)(version=1.7))"/>
|
||||
</requirement>
|
||||
</resource>
|
||||
<resource>
|
||||
<capability namespace="osgi.identity">
|
||||
<attribute name="license" value="http://www.opensource.org/licenses/apache2.0.php;description="Apache 2.0 Licensed";link=LICENSE"/>
|
||||
<attribute name="osgi.identity" value="org.amdatu.remote.admin.http"/>
|
||||
<attribute name="type" value="osgi.bundle"/>
|
||||
<attribute name="version" value="0.1.3" type="Version"/>
|
||||
</capability>
|
||||
<capability namespace="osgi.wiring.bundle">
|
||||
<attribute name="bundle-version" value="0.1.3" type="Version"/>
|
||||
<attribute name="osgi.wiring.bundle" value="org.amdatu.remote.admin.http"/>
|
||||
</capability>
|
||||
<capability namespace="osgi.wiring.host">
|
||||
<attribute name="bundle-version" value="0.1.3" type="Version"/>
|
||||
<attribute name="osgi.wiring.host" value="org.amdatu.remote.admin.http"/>
|
||||
</capability>
|
||||
<capability namespace="osgi.content">
|
||||
<attribute name="size" value="1602315" type="Long"/>
|
||||
<attribute name="url" value="org.amdatu.remote.admin.http-0.1.3.jar"/>
|
||||
<attribute name="mime" value="application/vnd.osgi.bundle"/>
|
||||
<attribute name="osgi.content" value="D8D767D5B8F0C72804F92895D0336A33616E7F5CCC7C3834C604532EB30CEE53"/>
|
||||
</capability>
|
||||
<capability namespace="osgi.remoteserviceadmin.distribution">
|
||||
<attribute name="configs" value="org.amdatu.remote.admin.http" type="List<String>"/>
|
||||
<attribute name="version" value="1.1.0" type="Version"/>
|
||||
</capability>
|
||||
<capability namespace="osgi.service">
|
||||
<directive name="uses" value="org.osgi.service.remoteserviceadmin"/>
|
||||
<attribute name="objectClass" value="org.osgi.service.remoteserviceadmin.RemoteServiceAdmin" type="List<String>"/>
|
||||
</capability>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(&(osgi.wiring.package=javax.servlet)(version>=2.6.0)(!(version>=3.0.0)))"/>
|
||||
<attribute name="osgi.wiring.package" value="javax.servlet"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(&(osgi.wiring.package=javax.servlet.http)(version>=2.6.0)(!(version>=3.0.0)))"/>
|
||||
<attribute name="osgi.wiring.package" value="javax.servlet.http"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(osgi.wiring.package=javax.xml.datatype)"/>
|
||||
<attribute name="osgi.wiring.package" value="javax.xml.datatype"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(osgi.wiring.package=javax.xml.namespace)"/>
|
||||
<attribute name="osgi.wiring.package" value="javax.xml.namespace"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(osgi.wiring.package=javax.xml.parsers)"/>
|
||||
<attribute name="osgi.wiring.package" value="javax.xml.parsers"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(&(osgi.wiring.package=org.apache.felix.dm)(version>=3.0.0)(!(version>=4.0.0)))"/>
|
||||
<attribute name="osgi.wiring.package" value="org.apache.felix.dm"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(&(osgi.wiring.package=org.osgi.framework)(version>=1.7.0)(!(version>=2.0.0)))"/>
|
||||
<attribute name="osgi.wiring.package" value="org.osgi.framework"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(&(osgi.wiring.package=org.osgi.service.cm)(version>=1.5.0)(!(version>=2.0.0)))"/>
|
||||
<attribute name="osgi.wiring.package" value="org.osgi.service.cm"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(&(osgi.wiring.package=org.osgi.service.event)(version>=1.3.0)(!(version>=2.0.0)))"/>
|
||||
<attribute name="osgi.wiring.package" value="org.osgi.service.event"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(&(osgi.wiring.package=org.osgi.service.http)(version>=1.2.0)(!(version>=2.0.0)))"/>
|
||||
<attribute name="osgi.wiring.package" value="org.osgi.service.http"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(&(osgi.wiring.package=org.osgi.service.log)(version>=1.3.0)(!(version>=2.0.0)))"/>
|
||||
<attribute name="osgi.wiring.package" value="org.osgi.service.log"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(&(osgi.wiring.package=org.osgi.service.remoteserviceadmin)(version>=1.1.0)(!(version>=2.0.0)))"/>
|
||||
<attribute name="osgi.wiring.package" value="org.osgi.service.remoteserviceadmin"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(osgi.wiring.package=org.w3c.dom)"/>
|
||||
<attribute name="osgi.wiring.package" value="org.w3c.dom"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(osgi.wiring.package=org.w3c.dom.bootstrap)"/>
|
||||
<attribute name="osgi.wiring.package" value="org.w3c.dom.bootstrap"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(osgi.wiring.package=org.w3c.dom.ls)"/>
|
||||
<attribute name="osgi.wiring.package" value="org.w3c.dom.ls"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(osgi.wiring.package=org.xml.sax)"/>
|
||||
<attribute name="osgi.wiring.package" value="org.xml.sax"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.wiring.package">
|
||||
<directive name="filter" value="(osgi.wiring.package=org.xml.sax.helpers)"/>
|
||||
<attribute name="osgi.wiring.package" value="org.xml.sax.helpers"/>
|
||||
</requirement>
|
||||
<requirement namespace="osgi.ee">
|
||||
<directive name="filter" value="(&(osgi.ee=JavaSE)(version=1.7))"/>
|
||||
</requirement>
|
||||
</resource>
|
||||
</repository>
|
||||
BIN
cnf/localrepo/org.amdatu.remote.admin.http-0.1.3.jar
Normal file
BIN
cnf/localrepo/org.amdatu.remote.admin.http-0.1.3.jar
Normal file
Binary file not shown.
BIN
cnf/localrepo/org.amdatu.remote.discovery.configured-0.1.3.jar
Normal file
BIN
cnf/localrepo/org.amdatu.remote.discovery.configured-0.1.3.jar
Normal file
Binary file not shown.
BIN
cnf/localrepo/org.amdatu.remote.topology.promiscuous-0.1.3.jar
Normal file
BIN
cnf/localrepo/org.amdatu.remote.topology.promiscuous-0.1.3.jar
Normal file
Binary file not shown.
5
com.thalesgroup.nl.chat.api/bnd.bnd
Normal file
5
com.thalesgroup.nl.chat.api/bnd.bnd
Normal file
@@ -0,0 +1,5 @@
|
||||
Bundle-Version: 1.0.0
|
||||
Export-Package: com.thalesgroup.nl.chat.api
|
||||
|
||||
-buildpath: \
|
||||
osgi.annotation
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.thalesgroup.nl.chat.api;
|
||||
|
||||
public interface Chat {
|
||||
void sendMessage(String author, String message);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
@Version("1.0.0")
|
||||
package com.thalesgroup.nl.chat.api;
|
||||
|
||||
import org.osgi.annotation.versioning.Version;
|
||||
9
com.thalesgroup.nl.chat.impl/bnd.bnd
Normal file
9
com.thalesgroup.nl.chat.impl/bnd.bnd
Normal file
@@ -0,0 +1,9 @@
|
||||
Bundle-Version: 1.0.0
|
||||
Private-Package: com.thalesgroup.nl.chat.impl
|
||||
|
||||
-buildpath: \
|
||||
osgi.core,\
|
||||
org.osgi.service.component,\
|
||||
org.osgi.service.component.annotations,\
|
||||
org.osgi.service.remoteserviceadmin,\
|
||||
com.thalesgroup.nl.chat.api;version=latest
|
||||
35
com.thalesgroup.nl.chat.impl/run.bndrun
Normal file
35
com.thalesgroup.nl.chat.impl/run.bndrun
Normal file
@@ -0,0 +1,35 @@
|
||||
-runfw: org.apache.felix.framework
|
||||
|
||||
-runproperties: \
|
||||
org.amdatu.remote.discovery.configured.endpoints='http://172.24.12.36:8080/org.amdatu.remote.discovery.configured,http://172.24.15.19:8080/org.amdatu.remote.discovery.configured,http://172.24.12.66:8080/org.amdatu.remote.discovery.configured,http://172.24.12.236:8080/org.amdatu.remote.discovery.configured,http://172.24.11.212:8080/org.amdatu.remote.discovery.configured,http://172.24.18.97:8080/org.amdatu.remote.discovery.configured,http://172.24.11.177:8080/org.amdatu.remote.discovery.configured,http://172.24.13.242:8080/org.amdatu.remote.discovery.configured,http://172.24.14.222:8080/org.amdatu.remote.discovery.configured,http://172.24.14.202:8080/org.amdatu.remote.discovery.configured',\
|
||||
org.amdatu.remote.discovery.configured.host=172.24.11.212,\
|
||||
org.amdatu.remote.admin.http.host=172.24.11.212,\
|
||||
org.amdatu.remote.admin.http.port=8080,\
|
||||
org.osgi.service.http.port=8080
|
||||
|
||||
-runfeatures: shell
|
||||
|
||||
-runbundles: \
|
||||
org.apache.felix.gogo.command,\
|
||||
org.apache.felix.gogo.runtime,\
|
||||
org.apache.felix.gogo.shell,\
|
||||
org.apache.felix.scr,\
|
||||
org.osgi.util.promise,\
|
||||
org.osgi.util.function,\
|
||||
org.apache.felix.configadmin,\
|
||||
org.apache.felix.configurator,\
|
||||
org.apache.felix.cm.json,\
|
||||
org.apache.sling.commons.johnzon,\
|
||||
org.apache.felix.converter,\
|
||||
org.amdatu.remote.admin.http,\
|
||||
org.amdatu.remote.discovery.configured,\
|
||||
org.amdatu.remote.topology.promiscuous,\
|
||||
org.apache.felix.metatype,\
|
||||
org.apache.felix.eventadmin,\
|
||||
org.apache.felix.log,\
|
||||
org.apache.felix.dependencymanager,\
|
||||
org.apache.felix.http.servlet-api,\
|
||||
org.apache.felix.http.jetty,\
|
||||
org.osgi.service.remoteserviceadmin,\
|
||||
com.thalesgroup.nl.chat.api;version=latest,\
|
||||
com.thalesgroup.nl.chat.impl;version=latest
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.thalesgroup.nl.chat.impl;
|
||||
|
||||
import com.thalesgroup.nl.chat.api.Chat;
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.remoteserviceadmin.RemoteConstants;
|
||||
|
||||
@Component(
|
||||
property = {RemoteConstants.SERVICE_EXPORTED_INTERFACES + "=com.thalesgroup.nl.chat.api.Chat",
|
||||
"participant.name=Bas"}
|
||||
)
|
||||
public class ChatImpl implements Chat {
|
||||
|
||||
@Override
|
||||
public void sendMessage(String author, String message){
|
||||
System.out.printf("%s: %s%n", author, message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.thalesgroup.nl.chat.impl;
|
||||
|
||||
import com.thalesgroup.nl.chat.api.Chat;
|
||||
import org.osgi.service.component.annotations.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Component(
|
||||
property = {
|
||||
"osgi.command.scope=chat",
|
||||
"osgi.command.function=send"
|
||||
},
|
||||
immediate = true,
|
||||
service = Object.class
|
||||
)
|
||||
public class ChatServer {
|
||||
public static final String NAME = "Bas";
|
||||
private Map<String, Chat> chatters = new HashMap<>();
|
||||
@Activate
|
||||
public ChatServer() {
|
||||
|
||||
}
|
||||
|
||||
@Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE)
|
||||
public void addChatter(Chat chat, Map props){
|
||||
String name = (String) props.get("participant.name");
|
||||
System.out.printf("Adding %s%n", name);
|
||||
chatters.put(name, chat);
|
||||
chat.sendMessage(NAME, String.format("Hoi %s!", name));
|
||||
}
|
||||
|
||||
public void removeChatter(Chat chat){
|
||||
chatters.remove(chat);
|
||||
}
|
||||
|
||||
public void send(String name, String message){
|
||||
Chat chat = chatters.get(name);
|
||||
if(chat == null){
|
||||
System.out.printf("Error: %s not found%n", name);
|
||||
} else {
|
||||
chat.sendMessage(NAME, message);
|
||||
}
|
||||
}
|
||||
|
||||
@Deactivate
|
||||
public void deactivate(){
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user