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:43 UTC
[24/35] karaf-boot git commit: Renaming dirs,
use blueprint-maven-plugin
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/karaf-boot-tools/pom.xml
----------------------------------------------------------------------
diff --git a/karaf-boot-tools/pom.xml b/karaf-boot-tools/pom.xml
deleted file mode 100644
index ccb9c88..0000000
--- a/karaf-boot-tools/pom.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?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>
-
- <parent>
- <groupId>org.apache.karaf.boot</groupId>
- <artifactId>karaf-boot-build</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>karaf-boot-tools</artifactId>
- <packaging>pom</packaging>
-
- <modules>
- <module>karaf-boot-maven-plugin</module>
- </modules>
-
-</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index eea3146..9127ab0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -37,14 +37,15 @@
<modules>
<!-- Core karaf-boot -->
- <module>karaf-boot-starters</module>
- <module>karaf-boot-tools</module>
+ <module>starters</module>
+ <module>tools</module>
<!-- embedded mode -->
<!-- Archetypes -->
<!-- TODO archetypes -->
<!-- Demos -->
+ <module>samples</module>
<!-- TODO complete library demos -->
</modules>
@@ -61,37 +62,5 @@
</plugins>
</build>
- <profiles>
- <profile>
- <id>samples</id>
- <modules>
- <!-- Samples -->
- <!-- services -->
- <module>karaf-boot-samples/karaf-boot-sample-service-provider-osgi</module>
- <module>karaf-boot-samples/karaf-boot-sample-service-consumer-osgi</module>
- <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>
- <!-- blueprint annotations -->
- <module>karaf-boot-samples/karaf-boot-sample-service-blueprint-annotation</module>
- <!-- cdi -->
- <module>karaf-boot-samples/karaf-boot-sample-cdi</module>
- <!-- shell -->
- <module>karaf-boot-samples/karaf-boot-sample-shell</module>
- <!-- config -->
- <module>karaf-boot-samples/karaf-boot-sample-config</module>
- <!-- jpa -->
- <module>karaf-boot-samples/karaf-boot-sample-jpa</module>
- <!-- servlet -->
- <module>karaf-boot-samples/karaf-boot-sample-servlet</module>
- <!-- webui / angular -->
- <!-- test -->
- <!-- rest & soap -->
- <!-- camel -->
- </modules>
- </profile>
- </profiles>
-
</project>
+
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/samples/README.md
----------------------------------------------------------------------
diff --git a/samples/README.md b/samples/README.md
new file mode 100644
index 0000000..d65c349
--- /dev/null
+++ b/samples/README.md
@@ -0,0 +1,27 @@
+* karaf-boot-sample-service-provider-osgi
+ Expose a service using the "native" Karaf OSGi layer (low level)
+* karaf-boot-sample-service-consumer-osgi
+ Use a service using the "native" Karaf OSGi layer (low level)
+
+* karaf-boot-services-osgi
+ Simple services using OSGi
+* karaf-boot-services-blueprint
+ Simple services using blueprint
+* karaf-boot-services-ds
+ Simple services using DS/SCR
+* karaf-boot-services-cdi
+ Simple services using CDI
+* karaf-boot-config-managed
+ Managed by configuration (reload)
+* karaf-boot-servlet
+ Servlet provider
+* karaf-boot-rest
+ REST service provider
+* karaf-boot-soap
+ SOAP service provider
+* karaf-boot-jpa
+ JPA implementation
+* karaf-boot-profile
+ Build a profile based on karaf-boot definition
+* karaf-boot-starter
+ Package and configure Karaf as a ready to run artifact
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/samples/blueprint/pom.xml
----------------------------------------------------------------------
diff --git a/samples/blueprint/pom.xml b/samples/blueprint/pom.xml
new file mode 100644
index 0000000..680358a
--- /dev/null
+++ b/samples/blueprint/pom.xml
@@ -0,0 +1,34 @@
+<?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-samples-blueprint</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>service-consumer</module>
+ <module>service-provider</module>
+ </modules>
+
+</project>
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/samples/blueprint/service-consumer/pom.xml
----------------------------------------------------------------------
diff --git a/samples/blueprint/service-consumer/pom.xml b/samples/blueprint/service-consumer/pom.xml
new file mode 100644
index 0000000..d482686
--- /dev/null
+++ b/samples/blueprint/service-consumer/pom.xml
@@ -0,0 +1,90 @@
+<?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.ops4j.pax.cdi</groupId>
+ <artifactId>pax-cdi-api</artifactId>
+ <version>0.5.0</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ <version>1</version>
+ <optional>true</optional>
+ </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>
+ <plugin>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>blueprint-maven-plugin</artifactId>
+ <version>1.3.0</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>blueprint-generate</goal>
+ </goals>
+ <phase>process-classes</phase>
+ </execution>
+ </executions>
+ <configuration>
+ <scanPaths>
+ <scanPath>sample</scanPath>
+ </scanPaths>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.3</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/samples/blueprint/service-consumer/src/main/java/sample/blueprint/service/consumer/HelloClient.java
----------------------------------------------------------------------
diff --git a/samples/blueprint/service-consumer/src/main/java/sample/blueprint/service/consumer/HelloClient.java b/samples/blueprint/service-consumer/src/main/java/sample/blueprint/service/consumer/HelloClient.java
new file mode 100644
index 0000000..ff568f8
--- /dev/null
+++ b/samples/blueprint/service-consumer/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 javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.ops4j.pax.cdi.api.OsgiService;
+
+import sample.blueprint.service.provider.HelloService;
+
+@Singleton
+public class HelloClient {
+
+ @Inject @OsgiService
+ HelloService helloService;
+
+ @PostConstruct
+ public void startUp() {
+ System.out.println(helloService.hello("World"));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/samples/blueprint/service-provider/README.md
----------------------------------------------------------------------
diff --git a/samples/blueprint/service-provider/README.md b/samples/blueprint/service-provider/README.md
new file mode 100644
index 0000000..07194df
--- /dev/null
+++ b/samples/blueprint/service-provider/README.md
@@ -0,0 +1,26 @@
+== karaf-boot-sample-service-provider-blueprint ==
+
+This sample exposes an OSGi service using blueprint.
+
+= Design
+
+The service "contract" is describe by the Hello interface. It's a very simple service that expose one operation (hello).
+The service client send a message (String) to the hello service and he gets a response.
+
+The HelloServiceImpl is very simple: it prefixes the message with "Hello".
+
+We use a blueprint XML descriptor (for blueprint annotations, see the corresponding sample) in order to expose the service.
+
+= Build
+
+To build, simply do:
+
+ mvn clean install
+
+= Deploy
+
+* you can drop the generated jar file (target/karaf-boot-sample-service-provider-blueprint-1.0.jar) in the
+Karaf deploy folder
+* in the Karaf shell console, do:
+
+ bundle:install -s mvn:org.apache.karaf.boot/karaf-boot-sample-service-provider-blueprint/1.0
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/samples/blueprint/service-provider/pom.xml
----------------------------------------------------------------------
diff --git a/samples/blueprint/service-provider/pom.xml b/samples/blueprint/service-provider/pom.xml
new file mode 100644
index 0000000..de9ab62
--- /dev/null
+++ b/samples/blueprint/service-provider/pom.xml
@@ -0,0 +1,80 @@
+<?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>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.karaf.boot</groupId>
+ <artifactId>karaf-boot-starter</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.cdi</groupId>
+ <artifactId>pax-cdi-api</artifactId>
+ <version>0.5.0</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ <version>1</version>
+ <optional>true</optional>
+ </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>
+ <plugin>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>blueprint-maven-plugin</artifactId>
+ <version>1.3.0</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>blueprint-generate</goal>
+ </goals>
+ <phase>process-classes</phase>
+ </execution>
+ </executions>
+ <configuration>
+ <scanPaths>
+ <scanPath>sample</scanPath>
+ </scanPaths>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.3</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/samples/blueprint/service-provider/src/main/java/sample/blueprint/service/provider/HelloService.java
----------------------------------------------------------------------
diff --git a/samples/blueprint/service-provider/src/main/java/sample/blueprint/service/provider/HelloService.java b/samples/blueprint/service-provider/src/main/java/sample/blueprint/service/provider/HelloService.java
new file mode 100644
index 0000000..2555069
--- /dev/null
+++ b/samples/blueprint/service-provider/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/137222a0/samples/blueprint/service-provider/src/main/java/sample/blueprint/service/provider/HelloServiceImpl.java
----------------------------------------------------------------------
diff --git a/samples/blueprint/service-provider/src/main/java/sample/blueprint/service/provider/HelloServiceImpl.java b/samples/blueprint/service-provider/src/main/java/sample/blueprint/service/provider/HelloServiceImpl.java
new file mode 100644
index 0000000..8287891
--- /dev/null
+++ b/samples/blueprint/service-provider/src/main/java/sample/blueprint/service/provider/HelloServiceImpl.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.provider;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Singleton;
+
+import org.ops4j.pax.cdi.api.OsgiServiceProvider;
+
+@OsgiServiceProvider(classes = HelloService.class)
+@Singleton
+public class HelloServiceImpl implements HelloService{
+
+ public String hello(String message) {
+ return "Hello " + message + " !";
+ }
+
+ @PostConstruct
+ public void startUp() {
+ System.out.println("I'm starting up!");
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/samples/cdi/README.md
----------------------------------------------------------------------
diff --git a/samples/cdi/README.md b/samples/cdi/README.md
new file mode 100644
index 0000000..1f98cac
--- /dev/null
+++ b/samples/cdi/README.md
@@ -0,0 +1,23 @@
+== karaf-boot-sample-cdi ==
+
+This sample shows how to define a CDI bundle.
+
+= Design
+
+TODO.
+
+= Build
+
+To build, simply do:
+
+ mvn clean install
+
+= Deploy
+
+To deploy i:
+
+* you can drop the generated jar file (target/karaf-boot-sample-cdi-1.0.jar) in the
+Karaf deploy folder
+* in the Karaf shell console, do:
+
+ bundle:install -s mvn:org.apache.karaf.boot/karaf-boot-sample-cdi/1.0
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/samples/cdi/pom.xml
----------------------------------------------------------------------
diff --git a/samples/cdi/pom.xml b/samples/cdi/pom.xml
new file mode 100644
index 0000000..1c4fac4
--- /dev/null
+++ b/samples/cdi/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-cdi</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.karaf.boot</groupId>
+ <artifactId>karaf-boot-starter-cdi</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>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.3</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/samples/cdi/src/main/java/sample/cdi/IceCreamService.java
----------------------------------------------------------------------
diff --git a/samples/cdi/src/main/java/sample/cdi/IceCreamService.java b/samples/cdi/src/main/java/sample/cdi/IceCreamService.java
new file mode 100644
index 0000000..5f9cfac
--- /dev/null
+++ b/samples/cdi/src/main/java/sample/cdi/IceCreamService.java
@@ -0,0 +1,6 @@
+package sample.cdi;
+
+public interface IceCreamService {
+
+ String getFlavour();
+}
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/samples/cdi/src/main/java/sample/cdi/impl/VanillaService.java
----------------------------------------------------------------------
diff --git a/samples/cdi/src/main/java/sample/cdi/impl/VanillaService.java b/samples/cdi/src/main/java/sample/cdi/impl/VanillaService.java
new file mode 100644
index 0000000..3007035
--- /dev/null
+++ b/samples/cdi/src/main/java/sample/cdi/impl/VanillaService.java
@@ -0,0 +1,45 @@
+/**
+ * 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.cdi.impl;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
+
+import org.ops4j.pax.cdi.api.OsgiServiceProvider;
+import org.ops4j.pax.cdi.api.Properties;
+import org.ops4j.pax.cdi.api.Property;
+import sample.cdi.IceCreamService;
+
+@OsgiServiceProvider(classes = { VanillaService.class, IceCreamService.class })
+@Properties(@Property(name = "flavour", value = "vanilla"))
+@ApplicationScoped
+class VanillaService implements IceCreamService {
+
+ private boolean initialized;
+
+ @PostConstruct
+ public void init() {
+ initialized = true;
+ }
+
+ public String getFlavour() {
+ if (!initialized) {
+ throw new AssertionError("VanillaService is not initialized");
+ }
+ return "Vanilla";
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/samples/ds/config/README.md
----------------------------------------------------------------------
diff --git a/samples/ds/config/README.md b/samples/ds/config/README.md
new file mode 100644
index 0000000..1c8dbc5
--- /dev/null
+++ b/samples/ds/config/README.md
@@ -0,0 +1,31 @@
+== karaf-boot-sample-config ==
+
+This sample shows how to use a configuration provided in the etc folder of Karaf, and directly use the
+properties values in your code.
+
+= Design
+
+The ConfigComponent use a SampleConfig configuration. The SampleConfig configuration is "injected" at activation
+time of the component.
+
+The component just displays the values of the properties.
+
+= Build
+
+To build, simply do:
+
+ mvn clean install
+
+= Deploy
+
+To deploy in Karaf, you have to enable the DS support first. For that, you have to install the scr feature:
+
+ feature:install scr
+
+Once scr feature installed:
+
+* you can drop the generated jar file (target/karaf-boot-sample-config-1.0.jar) in the
+Karaf deploy folder
+* in the Karaf shell console, do:
+
+ bundle:install -s mvn:org.apache.karaf.boot/karaf-boot-sample-config/1.0
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/samples/ds/config/pom.xml
----------------------------------------------------------------------
diff --git a/samples/ds/config/pom.xml b/samples/ds/config/pom.xml
new file mode 100644
index 0000000..688150b
--- /dev/null
+++ b/samples/ds/config/pom.xml
@@ -0,0 +1,47 @@
+<?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-config</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+
+ <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>
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/samples/ds/config/src/main/java/sample/config/ConfigComponent.java
----------------------------------------------------------------------
diff --git a/samples/ds/config/src/main/java/sample/config/ConfigComponent.java b/samples/ds/config/src/main/java/sample/config/ConfigComponent.java
new file mode 100644
index 0000000..52cf369
--- /dev/null
+++ b/samples/ds/config/src/main/java/sample/config/ConfigComponent.java
@@ -0,0 +1,43 @@
+/**
+ * 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.config;
+
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.metatype.annotations.Designate;
+import org.osgi.service.metatype.annotations.ObjectClassDefinition;
+
+@ObjectClassDefinition(name = "Sample Configuration", pid = "org.apache.karaf.boot.sample.config")
+@interface SampleConfig {
+ String stringProperty() default "default";
+ int intProperty() default 0;
+ boolean booleanProperty() default false;
+}
+
+@Component
+@Designate(ocd = SampleConfig.class)
+public class ConfigComponent {
+
+ @Activate
+ public void activate(SampleConfig sampleConfig) {
+ System.out.println("We use the property there");
+ System.out.println("stringProperty:" + sampleConfig.stringProperty());
+ System.out.println("intProperty: " + sampleConfig.intProperty());
+ System.out.println("booleanProperty: " + sampleConfig.booleanProperty());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/samples/ds/pom.xml
----------------------------------------------------------------------
diff --git a/samples/ds/pom.xml b/samples/ds/pom.xml
new file mode 100644
index 0000000..f031e88
--- /dev/null
+++ b/samples/ds/pom.xml
@@ -0,0 +1,36 @@
+<?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-samples-ds</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>config</module>
+ <module>service-consumer</module>
+ <module>service-provider</module>
+ <module>shell</module>
+ </modules>
+
+</project>
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/samples/ds/service-consumer/README.md
----------------------------------------------------------------------
diff --git a/samples/ds/service-consumer/README.md b/samples/ds/service-consumer/README.md
new file mode 100644
index 0000000..ae04875
--- /dev/null
+++ b/samples/ds/service-consumer/README.md
@@ -0,0 +1,36 @@
+== karaf-boot-sample-service-provider-osgi ==
+
+This sample exposes an OSGi service using the Karaf util classe and annotation.
+
+= Design
+
+This artifact uses the hello service provided by another artifact (karaf-boot-sample-service-provider-ds for instance).
+
+It uses the DS annotations to create a bean with a reference (@Reference) to the hello service.
+In the HelloServiceClient bean, we use the @Activate annotation to execute a specific method.
+
+You don't think anything else: karaf-boot will generate all the plumbing for you, and you will directly have a ready
+to use artifact.
+
+= Build
+
+To build, simply do:
+
+ mvn clean install
+
+= Deploy
+
+To deploy in Karaf, you have to enable the DS support first. For that, you have to install the scr feature:
+
+ feature:install scr
+
+Once scr feature installed, you have to install a hello service provider. Please use any of karaf-boot-sample-service-provider-*
+deployment first.
+
+Once the service provider is installed:
+
+* you can drop the generated jar file (target/karaf-boot-sample-service-consumer-ds-1.0.jar) in the
+Karaf deploy folder
+* in the Karaf shell console, do:
+
+ bundle:install -s mvn:org.apache.karaf.boot/karaf-boot-sample-service-consumer-ds/1.0
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/samples/ds/service-consumer/pom.xml
----------------------------------------------------------------------
diff --git a/samples/ds/service-consumer/pom.xml b/samples/ds/service-consumer/pom.xml
new file mode 100644
index 0000000..c6b85c0
--- /dev/null
+++ b/samples/ds/service-consumer/pom.xml
@@ -0,0 +1,52 @@
+<?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-ds</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.karaf.boot</groupId>
+ <artifactId>karaf-boot-starter-ds</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.karaf.boot</groupId>
+ <artifactId>karaf-boot-sample-service-provider-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/137222a0/samples/ds/service-consumer/src/main/java/sample/ds/service/consumer/HelloServiceClient.java
----------------------------------------------------------------------
diff --git a/samples/ds/service-consumer/src/main/java/sample/ds/service/consumer/HelloServiceClient.java b/samples/ds/service-consumer/src/main/java/sample/ds/service/consumer/HelloServiceClient.java
new file mode 100644
index 0000000..f70ebf7
--- /dev/null
+++ b/samples/ds/service-consumer/src/main/java/sample/ds/service/consumer/HelloServiceClient.java
@@ -0,0 +1,59 @@
+/**
+ * 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.ds.service.consumer;
+
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Reference;
+import sample.ds.service.provider.HelloService;
+
+@Component
+public class HelloServiceClient implements Runnable {
+
+ private HelloService helloService;
+
+ private Thread thread;
+
+ @Activate
+ public void start() {
+ thread = new Thread(this);
+ thread.start();
+ }
+
+ @Deactivate
+ public void stop() {
+ thread.interrupt();
+ }
+
+ public void run() {
+ while (true) {
+ System.out.println(helloService.hello("World"));
+ try {
+ Thread.sleep(5000);
+ } catch (Exception e) {
+ // nothing to do
+ }
+ }
+ }
+
+ @Reference
+ public void setHelloService(HelloService helloService) {
+ this.helloService = helloService;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/samples/ds/service-provider/README.md
----------------------------------------------------------------------
diff --git a/samples/ds/service-provider/README.md b/samples/ds/service-provider/README.md
new file mode 100644
index 0000000..94066f1
--- /dev/null
+++ b/samples/ds/service-provider/README.md
@@ -0,0 +1,35 @@
+== karaf-boot-sample-service-provider-ds ==
+
+This sample exposes an OSGi service using the Karaf util classe and annotation.
+
+= Design
+
+The service "contract" is describe by the Hello interface. It's a very simple service that expose one operation (hello).
+The service client send a message (String) to the hello service and he gets a response.
+
+The HelloServiceImpl is very simple: it prefixes the message with "Hello".
+
+We use the @Component DS annotation on HelloServiceImpl implementation in order to expose the service.
+
+You don't think anything else: karaf-boot will generate all the plumbing for you, and you will directly have a ready
+to use artifact.
+
+= Build
+
+To build, simply do:
+
+ mvn clean install
+
+= Deploy
+
+To deploy in Karaf, you have to enable the DS support first. For that, you have to install the scr feature:
+
+ feature:install scr
+
+Once scr feature installed:
+
+* you can drop the generated jar file (target/karaf-boot-sample-service-provider-ds-1.0.jar) in the
+Karaf deploy folder
+* in the Karaf shell console, do:
+
+ bundle:install -s mvn:org.apache.karaf.boot/karaf-boot-sample-service-provider-ds/1.0
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/samples/ds/service-provider/pom.xml
----------------------------------------------------------------------
diff --git a/samples/ds/service-provider/pom.xml b/samples/ds/service-provider/pom.xml
new file mode 100644
index 0000000..854a780
--- /dev/null
+++ b/samples/ds/service-provider/pom.xml
@@ -0,0 +1,47 @@
+<?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-ds</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+
+ <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/137222a0/samples/ds/service-provider/src/main/java/sample/ds/service/provider/HelloService.java
----------------------------------------------------------------------
diff --git a/samples/ds/service-provider/src/main/java/sample/ds/service/provider/HelloService.java b/samples/ds/service-provider/src/main/java/sample/ds/service/provider/HelloService.java
new file mode 100644
index 0000000..50c2d30
--- /dev/null
+++ b/samples/ds/service-provider/src/main/java/sample/ds/service/provider/HelloService.java
@@ -0,0 +1,26 @@
+/**
+ * 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.ds.service.provider;
+
+/**
+ * Simple hello service contract.
+ */
+public interface HelloService {
+
+ public String hello(String message);
+
+}
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/samples/ds/service-provider/src/main/java/sample/ds/service/provider/HelloServiceImpl.java
----------------------------------------------------------------------
diff --git a/samples/ds/service-provider/src/main/java/sample/ds/service/provider/HelloServiceImpl.java b/samples/ds/service-provider/src/main/java/sample/ds/service/provider/HelloServiceImpl.java
new file mode 100644
index 0000000..5319a47
--- /dev/null
+++ b/samples/ds/service-provider/src/main/java/sample/ds/service/provider/HelloServiceImpl.java
@@ -0,0 +1,31 @@
+/**
+ * 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.ds.service.provider;
+
+import org.osgi.service.component.annotations.Component;
+
+/**
+ * Simple implementation of the hello service..
+ */
+@Component
+public class HelloServiceImpl implements HelloService {
+
+ public String hello(String message) {
+ return "Hello " + message + " !";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/samples/ds/shell/README.md
----------------------------------------------------------------------
diff --git a/samples/ds/shell/README.md b/samples/ds/shell/README.md
new file mode 100644
index 0000000..dc6b380
--- /dev/null
+++ b/samples/ds/shell/README.md
@@ -0,0 +1,38 @@
+== karaf-boot-sample-shell ==
+
+This sample provides new shell command in the Karaf shell console, that uses the hello service, provided by another
+artifact (as karaf-boot-sample-service-provider-ds for instance).
+
+= Design
+
+The shell commands are exposed using the Karaf shell annotations.
+
+A command is basically a class implementing Action interface, and we use @Service, @Command, @Argument, @Option Karaf
+shell annotations.
+
+The @Reference annotation uses the hello service.
+
+= Build
+
+To build, simply do:
+
+ mvn clean install
+
+= Deploy
+
+You have to install a hello service provider first. Please deploy karaf-boot-sample-service-provider-ds first.
+
+To deploy in Karaf:
+
+* you can drop the generated jar file (target/karaf-boot-sample-shell-1.0.jar) in the
+Karaf deploy folder
+* in the Karaf shell console, do:
+
+ bundle:install -s mvn:org.apache.karaf.boot/karaf-boot-sample-shell/1.0
+
+= Usage
+
+Once deployed, you can use the sample:hello command like:
+
+karaf@root()> sample:hello world
+Hello world !
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/samples/ds/shell/pom.xml
----------------------------------------------------------------------
diff --git a/samples/ds/shell/pom.xml b/samples/ds/shell/pom.xml
new file mode 100644
index 0000000..1df8632
--- /dev/null
+++ b/samples/ds/shell/pom.xml
@@ -0,0 +1,53 @@
+<?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-shell</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.karaf.boot</groupId>
+ <artifactId>karaf-boot-starter-shell</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.karaf.boot</groupId>
+ <artifactId>karaf-boot-sample-service-provider-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>
+ <inherited>true</inherited>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/samples/ds/shell/src/main/java/sample/shell/HelloCommand.java
----------------------------------------------------------------------
diff --git a/samples/ds/shell/src/main/java/sample/shell/HelloCommand.java b/samples/ds/shell/src/main/java/sample/shell/HelloCommand.java
new file mode 100644
index 0000000..eb4a730
--- /dev/null
+++ b/samples/ds/shell/src/main/java/sample/shell/HelloCommand.java
@@ -0,0 +1,47 @@
+/**
+ * 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.shell;
+
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import sample.ds.service.provider.HelloService;
+
+@Service
+@Command(scope = "sample", name = "hello", description = "The hello command")
+public class HelloCommand implements Action {
+
+ @Reference
+ public HelloService helloService;
+
+ @Argument(index = 0, name = "arg", description = "This is the message argument", required = true, multiValued = false)
+ public String arg;
+
+ @Option(name = "opt", description = "This is an option", required = false, multiValued = false)
+ public String opt;
+
+ public Object execute() throws Exception {
+ if (opt != null)
+ System.out.println("Opt is " + opt);
+ System.out.println(helloService.hello(arg));
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/samples/jpa/README.md
----------------------------------------------------------------------
diff --git a/samples/jpa/README.md b/samples/jpa/README.md
new file mode 100644
index 0000000..3a3f6a3
--- /dev/null
+++ b/samples/jpa/README.md
@@ -0,0 +1,23 @@
+== karaf-boot-sample-jpa ==
+
+This sample shows how to define a JPA bundle and generate the persistent unit.
+
+= Design
+
+A Task entity is defined and annotated with the persistent unit annotations.
+
+= Build
+
+To build, simply do:
+
+ mvn clean install
+
+= Deploy
+
+To deploy i:
+
+* you can drop the generated jar file (target/karaf-boot-sample-jpa-1.0.jar) in the
+Karaf deploy folder
+* in the Karaf shell console, do:
+
+ bundle:install -s mvn:org.apache.karaf.boot/karaf-boot-sample-jpa/1.0
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/samples/jpa/pom.xml
----------------------------------------------------------------------
diff --git a/samples/jpa/pom.xml b/samples/jpa/pom.xml
new file mode 100644
index 0000000..032396f
--- /dev/null
+++ b/samples/jpa/pom.xml
@@ -0,0 +1,47 @@
+<?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-jpa</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.karaf.boot</groupId>
+ <artifactId>karaf-boot-starter-jpa</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>
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/samples/jpa/src/main/java/sample/jpa/Task.java
----------------------------------------------------------------------
diff --git a/samples/jpa/src/main/java/sample/jpa/Task.java b/samples/jpa/src/main/java/sample/jpa/Task.java
new file mode 100644
index 0000000..cd431a7
--- /dev/null
+++ b/samples/jpa/src/main/java/sample/jpa/Task.java
@@ -0,0 +1,66 @@
+/**
+ * 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.jpa;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.apache.karaf.boot.jpa.Hibernate;
+import org.apache.karaf.boot.jpa.PersistentUnit;
+import org.apache.karaf.boot.jpa.Property;
+import org.apache.karaf.boot.jpa.Provider;
+
+@PersistentUnit(name = "tasklist", provider = Provider.Hibernate, properties = {
+ @Property(name = "hibernate.hbm2ddl.auto", value = "create-drop")
+})
+@Hibernate.Dialect(Hibernate.Dialect.Value.HSQL)
+@Hibernate.Hbm2DdlAuto(Hibernate.Hbm2DdlAuto.Value.CreateDrop)
+@Entity
+@XmlRootElement
+public class Task {
+ @Id
+ Integer id;
+ String title;
+
+ public Task() {
+ }
+
+
+ public Task(Integer id, String title) {
+ super();
+ this.id = id;
+ this.title = title;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = new Integer(id);
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/samples/pom.xml
----------------------------------------------------------------------
diff --git a/samples/pom.xml b/samples/pom.xml
new file mode 100644
index 0000000..bdb5fee
--- /dev/null
+++ b/samples/pom.xml
@@ -0,0 +1,37 @@
+<?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-samples</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>blueprint</module>
+ <module>cdi</module>
+ <module>ds</module>
+ <module>jpa</module>
+ <module>servlet</module>
+ </modules>
+
+</project>
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/samples/servlet/README.md
----------------------------------------------------------------------
diff --git a/samples/servlet/README.md b/samples/servlet/README.md
new file mode 100644
index 0000000..75f940f
--- /dev/null
+++ b/samples/servlet/README.md
@@ -0,0 +1,30 @@
+== karaf-boot-sample-servlet ==
+
+This sample shows how to easily create a servlet, ready to be deployed in Karaf.
+
+= Design
+
+The SampleServlet is servlet containing the @WebServlet annotation.
+
+This servlet is directly deployed by Karaf as soon as it's deployed.
+
+= Build
+
+To build, simply do:
+
+ mvn clean install
+
+= Deploy
+
+To deploy in Karaf, you have to enable the web support by installing the http and http-whiteboard features:
+
+ feature:install http
+ feature:install http-whiteboard
+
+Once http features installed:
+
+* you can drop the generated jar file (target/karaf-boot-sample-servlet-1.0.jar) in the
+Karaf deploy folder
+* in the Karaf shell console, do:
+
+ bundle:install -s mvn:org.apache.karaf.boot/karaf-boot-sample-servlet/1.0
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/samples/servlet/pom.xml
----------------------------------------------------------------------
diff --git a/samples/servlet/pom.xml b/samples/servlet/pom.xml
new file mode 100644
index 0000000..773b00a
--- /dev/null
+++ b/samples/servlet/pom.xml
@@ -0,0 +1,47 @@
+<?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-servlet</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.karaf.boot</groupId>
+ <artifactId>karaf-boot-starter-web</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/137222a0/samples/servlet/src/main/java/sample/servlet/SampleServlet.java
----------------------------------------------------------------------
diff --git a/samples/servlet/src/main/java/sample/servlet/SampleServlet.java b/samples/servlet/src/main/java/sample/servlet/SampleServlet.java
new file mode 100644
index 0000000..d0069af
--- /dev/null
+++ b/samples/servlet/src/main/java/sample/servlet/SampleServlet.java
@@ -0,0 +1,44 @@
+/*
+ * 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.servlet;
+
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+@WebServlet(name = "SampleServlet", urlPatterns = {"/sample"})
+public class SampleServlet extends HttpServlet {
+
+ @Override
+ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ final PrintWriter writer = response.getWriter();
+ writer.println("<html>");
+ writer.println("<head>");
+ writer.println("<title>Sample</title>");
+ writer.println("</head>");
+ writer.println("<body align='center'>");
+ writer.println("<h1>Sample karaf-boot</h1>");
+ writer.println("</body>");
+ writer.println("</html>");
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/starters/karaf-boot-starter-blueprint/pom.xml
----------------------------------------------------------------------
diff --git a/starters/karaf-boot-starter-blueprint/pom.xml b/starters/karaf-boot-starter-blueprint/pom.xml
new file mode 100644
index 0000000..9f48c60
--- /dev/null
+++ b/starters/karaf-boot-starter-blueprint/pom.xml
@@ -0,0 +1,57 @@
+<?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>
+
+ <parent>
+ <groupId>org.apache.karaf.boot</groupId>
+ <artifactId>karaf-boot-starters</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>karaf-boot-starter-blueprint</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.api</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.annotation.api</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <compilerArgument>-proc:none</compilerArgument>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/starters/karaf-boot-starter-blueprint/src/main/java/org/apache/karaf/boot/blueprint/impl/BlueprintProcessor.java
----------------------------------------------------------------------
diff --git a/starters/karaf-boot-starter-blueprint/src/main/java/org/apache/karaf/boot/blueprint/impl/BlueprintProcessor.java b/starters/karaf-boot-starter-blueprint/src/main/java/org/apache/karaf/boot/blueprint/impl/BlueprintProcessor.java
new file mode 100644
index 0000000..896a161
--- /dev/null
+++ b/starters/karaf-boot-starter-blueprint/src/main/java/org/apache/karaf/boot/blueprint/impl/BlueprintProcessor.java
@@ -0,0 +1,76 @@
+package org.apache.karaf.boot.blueprint.impl;
+
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.RoundEnvironment;
+import javax.lang.model.element.TypeElement;
+import javax.tools.Diagnostic.Kind;
+import javax.tools.FileObject;
+import javax.tools.StandardLocation;
+import java.io.ByteArrayOutputStream;
+import java.io.CharArrayWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.io.Reader;
+import java.io.Writer;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.aries.blueprint.annotation.Bean;
+
+public class BlueprintProcessor extends AbstractProcessor {
+
+ boolean hasRun;
+
+ public BlueprintProcessor() {
+ }
+
+ @Override
+ public Set<String> getSupportedAnnotationTypes() {
+ Set<String> set = new HashSet<String>();
+ set.add(Bean.class.getName());
+ return set;
+ }
+
+ @Override
+ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+ if (!hasRun) {
+ hasRun = true;
+ // Add the blueprint requirement
+ try (PrintWriter w = appendResource("META-INF/org.apache.karaf.boot.bnd")) {
+ w.println("Bundle-Blueprint-Annotation: true");
+ } catch (Exception e) {
+ processingEnv.getMessager().printMessage(Kind.ERROR, "Error: " + e.getMessage());
+ }
+ }
+ return true;
+ }
+
+ private PrintWriter appendResource(String resource) throws IOException {
+ try {
+ FileObject o = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", resource);
+ return new PrintWriter(o.openWriter());
+ } catch (Exception e) {
+ try {
+ FileObject o = processingEnv.getFiler().getResource(StandardLocation.CLASS_OUTPUT, "", resource);
+ CharArrayWriter baos = new CharArrayWriter();
+ try (Reader r = o.openReader(true)) {
+ char[] buf = new char[4096];
+ int l;
+ while ((l = r.read(buf)) > 0) {
+ baos.write(buf, 0, l);
+ }
+ }
+ o.delete();
+ o = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", resource);
+ Writer w = o.openWriter();
+ w.write(baos.toCharArray());
+ return new PrintWriter(w);
+ } catch (Exception e2) {
+ e2.addSuppressed(e);
+ e2.printStackTrace();
+ throw e2;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/starters/karaf-boot-starter-blueprint/src/main/resources/META-INF/services/javax.annotation.processing.Processor
----------------------------------------------------------------------
diff --git a/starters/karaf-boot-starter-blueprint/src/main/resources/META-INF/services/javax.annotation.processing.Processor b/starters/karaf-boot-starter-blueprint/src/main/resources/META-INF/services/javax.annotation.processing.Processor
new file mode 100644
index 0000000..fab44d1
--- /dev/null
+++ b/starters/karaf-boot-starter-blueprint/src/main/resources/META-INF/services/javax.annotation.processing.Processor
@@ -0,0 +1 @@
+org.apache.karaf.boot.blueprint.impl.BlueprintProcessor
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/starters/karaf-boot-starter-cdi/pom.xml
----------------------------------------------------------------------
diff --git a/starters/karaf-boot-starter-cdi/pom.xml b/starters/karaf-boot-starter-cdi/pom.xml
new file mode 100644
index 0000000..3f33d28
--- /dev/null
+++ b/starters/karaf-boot-starter-cdi/pom.xml
@@ -0,0 +1,67 @@
+<?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>
+
+ <parent>
+ <groupId>org.apache.karaf.boot</groupId>
+ <artifactId>karaf-boot-starters</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>karaf-boot-starter-cdi</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>osgi.cmpn</artifactId>
+ <version>${osgi.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.cdi</groupId>
+ <artifactId>pax-cdi-api</artifactId>
+ <version>${pax.cdi.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ <version>1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <compilerArgument>-proc:none</compilerArgument>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/starters/karaf-boot-starter-cdi/src/main/java/org/apache/karaf/boot/cdi/impl/CdiProcessor.java
----------------------------------------------------------------------
diff --git a/starters/karaf-boot-starter-cdi/src/main/java/org/apache/karaf/boot/cdi/impl/CdiProcessor.java b/starters/karaf-boot-starter-cdi/src/main/java/org/apache/karaf/boot/cdi/impl/CdiProcessor.java
new file mode 100644
index 0000000..44cc571
--- /dev/null
+++ b/starters/karaf-boot-starter-cdi/src/main/java/org/apache/karaf/boot/cdi/impl/CdiProcessor.java
@@ -0,0 +1,82 @@
+package org.apache.karaf.boot.cdi.impl;
+
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.RoundEnvironment;
+import javax.lang.model.element.TypeElement;
+import javax.tools.Diagnostic.Kind;
+import javax.tools.FileObject;
+import javax.tools.StandardLocation;
+import java.io.ByteArrayOutputStream;
+import java.io.CharArrayWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.io.Reader;
+import java.io.Writer;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.ops4j.pax.cdi.api.OsgiServiceProvider;
+
+public class CdiProcessor extends AbstractProcessor {
+
+ boolean hasRun;
+
+ public CdiProcessor() {
+ }
+
+ @Override
+ public Set<String> getSupportedAnnotationTypes() {
+ Set<String> set = new HashSet<String>();
+ set.add(OsgiServiceProvider.class.getName());
+ return set;
+ }
+
+ @Override
+ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+ if (!hasRun) {
+ hasRun = true;
+ // Make sure we have a META-INF/beans.xml file present
+ try (PrintWriter w = appendResource("META-INF/beans.xml")) {
+ processingEnv.getMessager().printMessage(Kind.NOTE, "Generated META-INF/beans.xml");
+ } catch (Exception e) {
+ processingEnv.getMessager().printMessage(Kind.ERROR, "Error: " + e.getMessage());
+ }
+ // Add the CDI requirement
+ try (PrintWriter w = appendResource("META-INF/org.apache.karaf.boot.bnd")) {
+ w.println("Require-Capability: osgi.extender; filter:=\"(osgi.extender=pax.cdi)\"");
+ } catch (Exception e) {
+ processingEnv.getMessager().printMessage(Kind.ERROR, "Error: " + e.getMessage());
+ }
+ }
+ return true;
+ }
+
+ private PrintWriter appendResource(String resource) throws IOException {
+ try {
+ FileObject o = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", resource);
+ return new PrintWriter(o.openWriter());
+ } catch (Exception e) {
+ try {
+ FileObject o = processingEnv.getFiler().getResource(StandardLocation.CLASS_OUTPUT, "", resource);
+ CharArrayWriter baos = new CharArrayWriter();
+ try (Reader r = o.openReader(true)) {
+ char[] buf = new char[4096];
+ int l;
+ while ((l = r.read(buf)) > 0) {
+ baos.write(buf, 0, l);
+ }
+ }
+ o.delete();
+ o = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", resource);
+ Writer w = o.openWriter();
+ w.write(baos.toCharArray());
+ return new PrintWriter(w);
+ } catch (Exception e2) {
+ e2.addSuppressed(e);
+ e2.printStackTrace();
+ throw e2;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/starters/karaf-boot-starter-cdi/src/main/resources/META-INF/services/javax.annotation.processing.Processor
----------------------------------------------------------------------
diff --git a/starters/karaf-boot-starter-cdi/src/main/resources/META-INF/services/javax.annotation.processing.Processor b/starters/karaf-boot-starter-cdi/src/main/resources/META-INF/services/javax.annotation.processing.Processor
new file mode 100644
index 0000000..a6cd494
--- /dev/null
+++ b/starters/karaf-boot-starter-cdi/src/main/resources/META-INF/services/javax.annotation.processing.Processor
@@ -0,0 +1 @@
+org.apache.karaf.boot.cdi.impl.CdiProcessor
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/starters/karaf-boot-starter-ds/pom.xml
----------------------------------------------------------------------
diff --git a/starters/karaf-boot-starter-ds/pom.xml b/starters/karaf-boot-starter-ds/pom.xml
new file mode 100644
index 0000000..331c8e2
--- /dev/null
+++ b/starters/karaf-boot-starter-ds/pom.xml
@@ -0,0 +1,52 @@
+<?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>
+
+ <parent>
+ <groupId>org.apache.karaf.boot</groupId>
+ <artifactId>karaf-boot-starters</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>karaf-boot-starter-ds</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>osgi.cmpn</artifactId>
+ <version>${osgi.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <compilerArgument>-proc:none</compilerArgument>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/starters/karaf-boot-starter-ds/src/main/java/org/apache/karaf/boot/ds/impl/DsProcessor.java
----------------------------------------------------------------------
diff --git a/starters/karaf-boot-starter-ds/src/main/java/org/apache/karaf/boot/ds/impl/DsProcessor.java b/starters/karaf-boot-starter-ds/src/main/java/org/apache/karaf/boot/ds/impl/DsProcessor.java
new file mode 100644
index 0000000..49baa70
--- /dev/null
+++ b/starters/karaf-boot-starter-ds/src/main/java/org/apache/karaf/boot/ds/impl/DsProcessor.java
@@ -0,0 +1,72 @@
+package org.apache.karaf.boot.ds.impl;
+
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.RoundEnvironment;
+import javax.lang.model.element.TypeElement;
+import javax.tools.Diagnostic.Kind;
+import javax.tools.FileObject;
+import javax.tools.StandardLocation;
+import java.io.CharArrayWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.Reader;
+import java.io.Writer;
+import java.util.HashSet;
+import java.util.Set;
+
+public class DsProcessor extends AbstractProcessor {
+
+ boolean hasRun;
+
+ public DsProcessor() {
+ }
+
+ @Override
+ public Set<String> getSupportedAnnotationTypes() {
+ Set<String> set = new HashSet<String>();
+ set.add(org.osgi.service.component.annotations.Component.class.getName());
+ return set;
+ }
+
+ @Override
+ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+ if (!hasRun) {
+ hasRun = true;
+ // Add the Karaf embedded package
+ try (PrintWriter w = appendResource("META-INF/org.apache.karaf.boot.bnd")) {
+ w.println("_dsannotations: *");
+ } catch (Exception e) {
+ processingEnv.getMessager().printMessage(Kind.ERROR, "Error: " + e.getMessage());
+ }
+ }
+ return true;
+ }
+
+ private PrintWriter appendResource(String resource) throws IOException {
+ try {
+ FileObject o = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", resource);
+ return new PrintWriter(o.openWriter());
+ } catch (Exception e) {
+ try {
+ FileObject o = processingEnv.getFiler().getResource(StandardLocation.CLASS_OUTPUT, "", resource);
+ CharArrayWriter baos = new CharArrayWriter();
+ try (Reader r = o.openReader(true)) {
+ char[] buf = new char[4096];
+ int l;
+ while ((l = r.read(buf)) > 0) {
+ baos.write(buf, 0, l);
+ }
+ }
+ o.delete();
+ o = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", resource);
+ Writer w = o.openWriter();
+ w.write(baos.toCharArray());
+ return new PrintWriter(w);
+ } catch (Exception e2) {
+ e2.addSuppressed(e);
+ e2.printStackTrace();
+ throw e2;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/137222a0/starters/karaf-boot-starter-ds/src/main/resources/META-INF/services/javax.annotation.processing.Processor
----------------------------------------------------------------------
diff --git a/starters/karaf-boot-starter-ds/src/main/resources/META-INF/services/javax.annotation.processing.Processor b/starters/karaf-boot-starter-ds/src/main/resources/META-INF/services/javax.annotation.processing.Processor
new file mode 100644
index 0000000..11ef8af
--- /dev/null
+++ b/starters/karaf-boot-starter-ds/src/main/resources/META-INF/services/javax.annotation.processing.Processor
@@ -0,0 +1 @@
+org.apache.karaf.boot.ds.impl.DsProcessor