You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by cs...@apache.org on 2016/05/09 14:48:30 UTC
[11/35] karaf-boot git commit: Added a blueprint service sample
Added a blueprint service sample
Project: http://git-wip-us.apache.org/repos/asf/karaf-boot/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf-boot/commit/dcdd4b4c
Tree: http://git-wip-us.apache.org/repos/asf/karaf-boot/tree/dcdd4b4c
Diff: http://git-wip-us.apache.org/repos/asf/karaf-boot/diff/dcdd4b4c
Branch: refs/heads/master
Commit: dcdd4b4cdbb58a69118f60bd6eafaab8abd42f1a
Parents: c06650c
Author: Morgan Hautman <mo...@gmail.com>
Authored: Wed Oct 28 16:37:30 2015 +0100
Committer: Morgan Hautman <mo...@gmail.com>
Committed: Wed Oct 28 16:37:30 2015 +0100
----------------------------------------------------------------------
.../pom.xml | 51 ++++++++++++++++++++
.../blueprint/service/consumer/HelloClient.java | 38 +++++++++++++++
.../resources/OSGI-INF/blueprint/config.xml | 26 ++++++++++
.../pom.xml | 50 +++++++++++++++++++
.../service/provider/HelloService.java | 25 ++++++++++
.../service/provider/HelloServiceImpl.java | 30 ++++++++++++
.../resources/OSGI-INF/blueprint/config.xml | 26 ++++++++++
pom.xml | 2 +
8 files changed, 248 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/dcdd4b4c/karaf-boot-samples/karaf-boot-sample-service-consumer-blueprint/pom.xml
----------------------------------------------------------------------
diff --git a/karaf-boot-samples/karaf-boot-sample-service-consumer-blueprint/pom.xml b/karaf-boot-samples/karaf-boot-sample-service-consumer-blueprint/pom.xml
new file mode 100644
index 0000000..eee6bb9
--- /dev/null
+++ b/karaf-boot-samples/karaf-boot-sample-service-consumer-blueprint/pom.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version
+ 2.0 (the "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+ CONDITIONS OF ANY KIND, either express or implied. See the License for
+ the specific language governing permissions and limitations under the
+ License.
+-->
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.karaf.boot</groupId>
+ <artifactId>karaf-boot-sample-service-consumer-blueprint</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.karaf.boot</groupId>
+ <artifactId>karaf-boot-starter</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.karaf.boot</groupId>
+ <artifactId>karaf-boot-sample-service-provider-blueprint</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.karaf.boot</groupId>
+ <artifactId>karaf-boot-maven-plugin</artifactId>
+ <version>${project.version}</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/dcdd4b4c/karaf-boot-samples/karaf-boot-sample-service-consumer-blueprint/src/main/java/sample/blueprint/service/consumer/HelloClient.java
----------------------------------------------------------------------
diff --git a/karaf-boot-samples/karaf-boot-sample-service-consumer-blueprint/src/main/java/sample/blueprint/service/consumer/HelloClient.java b/karaf-boot-samples/karaf-boot-sample-service-consumer-blueprint/src/main/java/sample/blueprint/service/consumer/HelloClient.java
new file mode 100644
index 0000000..0459ab9
--- /dev/null
+++ b/karaf-boot-samples/karaf-boot-sample-service-consumer-blueprint/src/main/java/sample/blueprint/service/consumer/HelloClient.java
@@ -0,0 +1,38 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package sample.blueprint.service.consumer;
+
+import sample.blueprint.service.provider.HelloService;
+
+public class HelloClient {
+
+ HelloService helloService = null;
+
+ public void startUp() {
+ System.out.println(helloService.hello("World"));
+ }
+
+ public HelloService getHelloWorldService() {
+ return helloService;
+ }
+
+ public void setHelloWorldService(HelloService helloWorldService) {
+ this.helloService = helloWorldService;
+
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/dcdd4b4c/karaf-boot-samples/karaf-boot-sample-service-consumer-blueprint/src/main/resources/OSGI-INF/blueprint/config.xml
----------------------------------------------------------------------
diff --git a/karaf-boot-samples/karaf-boot-sample-service-consumer-blueprint/src/main/resources/OSGI-INF/blueprint/config.xml b/karaf-boot-samples/karaf-boot-sample-service-consumer-blueprint/src/main/resources/OSGI-INF/blueprint/config.xml
new file mode 100644
index 0000000..ccd26d8
--- /dev/null
+++ b/karaf-boot-samples/karaf-boot-sample-service-consumer-blueprint/src/main/resources/OSGI-INF/blueprint/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version
+ 2.0 (the "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+ CONDITIONS OF ANY KIND, either express or implied. See the License for
+ the specific language governing permissions and limitations under the
+ License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+ <reference id="helloservice"
+ interface="sample.blueprint.service.provider.HelloService" />
+
+
+ <bean id="helloclient" class="sample.blueprint.service.consumer.HelloClient"
+ init-method="startUp">
+ <property name="helloWorldService" ref="helloservice" />
+ </bean>
+</blueprint>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/dcdd4b4c/karaf-boot-samples/karaf-boot-sample-service-provider-blueprint/pom.xml
----------------------------------------------------------------------
diff --git a/karaf-boot-samples/karaf-boot-sample-service-provider-blueprint/pom.xml b/karaf-boot-samples/karaf-boot-sample-service-provider-blueprint/pom.xml
new file mode 100644
index 0000000..4f0d59b
--- /dev/null
+++ b/karaf-boot-samples/karaf-boot-sample-service-provider-blueprint/pom.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.karaf.boot</groupId>
+ <artifactId>karaf-boot-sample-service-provider-blueprint</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+
+ <!-- TODO Change DS to blueprint-->
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.karaf.boot</groupId>
+ <artifactId>karaf-boot-starter-ds</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.karaf.boot</groupId>
+ <artifactId>karaf-boot-maven-plugin</artifactId>
+ <version>${project.version}</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/dcdd4b4c/karaf-boot-samples/karaf-boot-sample-service-provider-blueprint/src/main/java/sample/blueprint/service/provider/HelloService.java
----------------------------------------------------------------------
diff --git a/karaf-boot-samples/karaf-boot-sample-service-provider-blueprint/src/main/java/sample/blueprint/service/provider/HelloService.java b/karaf-boot-samples/karaf-boot-sample-service-provider-blueprint/src/main/java/sample/blueprint/service/provider/HelloService.java
new file mode 100644
index 0000000..2555069
--- /dev/null
+++ b/karaf-boot-samples/karaf-boot-sample-service-provider-blueprint/src/main/java/sample/blueprint/service/provider/HelloService.java
@@ -0,0 +1,25 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package sample.blueprint.service.provider;
+
+public interface HelloService {
+
+ public String hello(String message);
+
+ public void startUp();
+
+}
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/dcdd4b4c/karaf-boot-samples/karaf-boot-sample-service-provider-blueprint/src/main/java/sample/blueprint/service/provider/HelloServiceImpl.java
----------------------------------------------------------------------
diff --git a/karaf-boot-samples/karaf-boot-sample-service-provider-blueprint/src/main/java/sample/blueprint/service/provider/HelloServiceImpl.java b/karaf-boot-samples/karaf-boot-sample-service-provider-blueprint/src/main/java/sample/blueprint/service/provider/HelloServiceImpl.java
new file mode 100644
index 0000000..4f97468
--- /dev/null
+++ b/karaf-boot-samples/karaf-boot-sample-service-provider-blueprint/src/main/java/sample/blueprint/service/provider/HelloServiceImpl.java
@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package sample.blueprint.service.provider;
+
+public class HelloServiceImpl implements HelloService{
+
+ public String hello(String message) {
+ return "Hello " + message + " !";
+ }
+
+ public void startUp() {
+ System.out.println("I'm starting up!");
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/dcdd4b4c/karaf-boot-samples/karaf-boot-sample-service-provider-blueprint/src/main/resources/OSGI-INF/blueprint/config.xml
----------------------------------------------------------------------
diff --git a/karaf-boot-samples/karaf-boot-sample-service-provider-blueprint/src/main/resources/OSGI-INF/blueprint/config.xml b/karaf-boot-samples/karaf-boot-sample-service-provider-blueprint/src/main/resources/OSGI-INF/blueprint/config.xml
new file mode 100644
index 0000000..f85ae0a
--- /dev/null
+++ b/karaf-boot-samples/karaf-boot-sample-service-provider-blueprint/src/main/resources/OSGI-INF/blueprint/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version
+ 2.0 (the "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+ CONDITIONS OF ANY KIND, either express or implied. See the License for
+ the specific language governing permissions and limitations under the
+ License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+ <bean id="helloservice"
+ class="sample.blueprint.service.provider.HelloServiceImpl"
+ init-method="startUp" >
+ </bean>
+
+ <service ref="helloservice"
+ interface="sample.blueprint.service.provider.HelloService" />
+
+</blueprint>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/dcdd4b4c/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 922cc9a..1161390 100644
--- a/pom.xml
+++ b/pom.xml
@@ -58,6 +58,8 @@
<module>karaf-boot-samples/karaf-boot-sample-service-provider-ds</module>
<module>karaf-boot-samples/karaf-boot-sample-service-consumer-ds</module>
<!-- blueprint -->
+ <module>karaf-boot-samples/karaf-boot-sample-service-provider-blueprint</module>
+ <module>karaf-boot-samples/karaf-boot-sample-service-consumer-blueprint</module>
<!-- cdi -->
<!-- shell -->
<module>karaf-boot-samples/karaf-boot-sample-shell</module>