update MAven tutorial (with XML and annotations)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1470285 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/distributions/maven-tutorial/annotations/hello.client.annotations/pom.xml b/ipojo/distributions/maven-tutorial/annotations/hello.client.annotations/pom.xml
new file mode 100644
index 0000000..b4d6c95
--- /dev/null
+++ b/ipojo/distributions/maven-tutorial/annotations/hello.client.annotations/pom.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-tutorial</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <packaging>bundle</packaging>
+
+ <artifactId>hello.client.annotations</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>hello.service</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Private-Package>
+ ipojo.example.hello.client
+ </Private-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-ipojo-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>ipojo-bundle</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
diff --git a/ipojo/distributions/maven-tutorial/annotations/hello.client.annotations/src/main/java/ipojo/example/hello/client/HelloClient.java b/ipojo/distributions/maven-tutorial/annotations/hello.client.annotations/src/main/java/ipojo/example/hello/client/HelloClient.java
new file mode 100644
index 0000000..1170f3c
--- /dev/null
+++ b/ipojo/distributions/maven-tutorial/annotations/hello.client.annotations/src/main/java/ipojo/example/hello/client/HelloClient.java
@@ -0,0 +1,88 @@
+/*
+ * 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 ipojo.example.hello.client;
+
+import ipojo.example.hello.Hello;
+import org.apache.felix.ipojo.annotations.*;
+
+/**
+ * A simple Hello service client. This client use annotation instead of XML metadata.
+ * If no Hello provider are available, it uses a default implementation.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@Component(name = "AnnotatedHelloClient")
+@Instantiate
+public class HelloClient implements Runnable {
+
+ /**
+ * Delay between two invocations.
+ */
+ private static final int DELAY = 10000;
+ /**
+ * Hello services. Injected by the container.
+ */
+ @Requires(optional = true, defaultimplementation = MyDummyHello.class)
+ private Hello hello;
+ /**
+ * End flag.
+ */
+ private boolean m_end;
+
+ /**
+ * Run method.
+ *
+ * @see Runnable#run()
+ */
+ public void run() {
+ while (!m_end) {
+ try {
+ invokeHelloServices();
+ Thread.sleep(DELAY);
+ } catch (InterruptedException ie) {
+ /* will recheck end */
+ }
+ }
+ }
+
+ /**
+ * Invoke hello services.
+ */
+ public void invokeHelloServices() {
+ System.out.println(hello.sayHello("Clement "));
+ }
+
+ /**
+ * Starting.
+ */
+ @Validate
+ public void starting() {
+ Thread thread = new Thread(this);
+ m_end = false;
+ thread.start();
+ }
+
+ /**
+ * Stopping.
+ */
+ @Invalidate
+ public void stopping() {
+ m_end = true;
+ }
+}
diff --git a/ipojo/distributions/maven-tutorial/annotations/hello.client.annotations/src/main/java/ipojo/example/hello/client/MyDummyHello.java b/ipojo/distributions/maven-tutorial/annotations/hello.client.annotations/src/main/java/ipojo/example/hello/client/MyDummyHello.java
new file mode 100644
index 0000000..16e09c3
--- /dev/null
+++ b/ipojo/distributions/maven-tutorial/annotations/hello.client.annotations/src/main/java/ipojo/example/hello/client/MyDummyHello.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 ipojo.example.hello.client;
+
+import ipojo.example.hello.Hello;
+
+public class MyDummyHello implements Hello {
+
+ public String sayHello(String name) {
+ return "Bonjour";
+ }
+
+}
diff --git a/ipojo/distributions/maven-tutorial/annotations/hello.felix.annotations/pom.xml b/ipojo/distributions/maven-tutorial/annotations/hello.felix.annotations/pom.xml
new file mode 100644
index 0000000..60ac6f4
--- /dev/null
+++ b/ipojo/distributions/maven-tutorial/annotations/hello.felix.annotations/pom.xml
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-tutorial</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>hello.felix.annotations</artifactId>
+
+ <description>A project building a Felix with the annotated Hello service and client</description>
+
+ <packaging>pom</packaging>
+
+ <dependencies>
+ <!-- our project -->
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>hello.service</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>hello.impl.annotations</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>hello.client.annotations</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.7</version>
+ <executions>
+
+ <execution>
+ <id>unpack-felix</id>
+ <phase>package</phase>
+ <goals>
+ <goal>unpack-dependencies</goal>
+ </goals>
+ <configuration>
+ <includeArtifactIds>org.apache.felix.main.distribution</includeArtifactIds>
+ <outputDirectory>${project.build.directory}</outputDirectory>
+ </configuration>
+ </execution>
+
+ <execution>
+ <id>copy-bundles</id>
+ <phase>package</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <includeArtifactIds>
+ hello.service,
+ hello.impl.annotations,
+ hello.client.annotations,
+ org.apache.felix.log,org.apache.felix.ipojo,
+ org.apache.felix.ipojo.arch.gogo
+ </includeArtifactIds>
+ <outputDirectory>${project.build.directory}/felix-framework-${felix.version}/bundle
+ </outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+
+
+</project>
\ No newline at end of file
diff --git a/ipojo/distributions/maven-tutorial/annotations/hello.impl.annotations/pom.xml b/ipojo/distributions/maven-tutorial/annotations/hello.impl.annotations/pom.xml
new file mode 100644
index 0000000..3aa6684
--- /dev/null
+++ b/ipojo/distributions/maven-tutorial/annotations/hello.impl.annotations/pom.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-tutorial</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>hello.impl.annotations</artifactId>
+
+ <packaging>bundle</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>hello.service</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Private-Package>
+ ipojo.example.hello.impl
+ </Private-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-ipojo-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>ipojo-bundle</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
diff --git a/ipojo/distributions/maven-tutorial/annotations/hello.impl.annotations/src/main/java/ipojo/example/hello/impl/HelloImpl.java b/ipojo/distributions/maven-tutorial/annotations/hello.impl.annotations/src/main/java/ipojo/example/hello/impl/HelloImpl.java
new file mode 100644
index 0000000..93ccaa9
--- /dev/null
+++ b/ipojo/distributions/maven-tutorial/annotations/hello.impl.annotations/src/main/java/ipojo/example/hello/impl/HelloImpl.java
@@ -0,0 +1,53 @@
+/*
+ * 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 ipojo.example.hello.impl;
+
+import ipojo.example.hello.Hello;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Instantiate;
+import org.apache.felix.ipojo.annotations.Provides;
+import org.apache.felix.ipojo.annotations.ServiceProperty;
+
+/**
+ * Component implementing the Hello service.
+ * This class used annotations to describe the component type.
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@Component
+@Provides
+@Instantiate // Declare an instance of the component
+public class HelloImpl implements Hello {
+
+
+ @ServiceProperty
+ public String boo = "boo";
+
+ @ServiceProperty
+ public String bla = "bla";
+
+
+ /**
+ * Returns an 'Hello' message.
+ * @param name : name
+ * @return Hello message
+ * @see ipojo.example.hello.Hello#sayHello(String)
+ */
+ public String sayHello(String name) { return "hello " + name + " @"; }
+}
diff --git a/ipojo/distributions/maven-tutorial/hello.service/pom.xml b/ipojo/distributions/maven-tutorial/hello.service/pom.xml
new file mode 100644
index 0000000..e188c91
--- /dev/null
+++ b/ipojo/distributions/maven-tutorial/hello.service/pom.xml
@@ -0,0 +1,48 @@
+<!--
+ ~ 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.
+ -->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-tutorial</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ </parent>
+
+ <packaging>bundle</packaging>
+
+ <artifactId>hello.service</artifactId>
+ <name>Hello Service</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Export-Package>
+ ipojo.example.hello
+ </Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/ipojo/distributions/maven-tutorial/hello.service/src/main/java/ipojo/example/hello/Hello.java b/ipojo/distributions/maven-tutorial/hello.service/src/main/java/ipojo/example/hello/Hello.java
new file mode 100644
index 0000000..e0c25da
--- /dev/null
+++ b/ipojo/distributions/maven-tutorial/hello.service/src/main/java/ipojo/example/hello/Hello.java
@@ -0,0 +1,33 @@
+/*
+ * 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 ipojo.example.hello;
+
+/**
+ * Hello Interface.
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public interface Hello {
+
+ /**
+ * Returns a message like: "Hello $user_name".
+ * @param name the name
+ * @return the hello message
+ */
+ String sayHello(String name);
+}
diff --git a/ipojo/distributions/maven-tutorial/pom.xml b/ipojo/distributions/maven-tutorial/pom.xml
new file mode 100644
index 0000000..34326f0
--- /dev/null
+++ b/ipojo/distributions/maven-tutorial/pom.xml
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-tutorial</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+
+ <packaging>pom</packaging>
+
+ <description>
+ The iPOJO Maven tutorial
+ </description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.main.distribution</artifactId>
+ <type>zip</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.arch.gogo</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.annotations</artifactId>
+ </dependency>
+ </dependencies>
+
+ <modules>
+ <module>hello.service</module>
+
+ <!-- XML -->
+ <module>xml/hello.impl.xml</module>
+ <module>xml/hello.client.xml</module>
+ <module>xml/hello.felix.xml</module>
+
+ <!-- Annotation -->
+ <module>annotations/hello.impl.annotations</module>
+ <module>annotations/hello.client.annotations</module>
+ <module>annotations/hello.felix.annotations</module>
+ </modules>
+
+ <properties>
+ <felix.version>4.2.1</felix.version>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo</artifactId>
+ <version>1.8.6</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.arch.gogo</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.main.distribution</artifactId>
+ <version>4.2.1</version>
+ <type>zip</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.annotations</artifactId>
+ <version>1.8.6</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>2.3.7</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-ipojo-plugin</artifactId>
+ <version>1.8.6</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.4</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptorRefs>
+ <ref>project</ref>
+ </descriptorRefs>
+ <attach>true</attach>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
diff --git a/ipojo/distributions/maven-tutorial/xml/hello.client.xml/pom.xml b/ipojo/distributions/maven-tutorial/xml/hello.client.xml/pom.xml
new file mode 100644
index 0000000..c0430fd
--- /dev/null
+++ b/ipojo/distributions/maven-tutorial/xml/hello.client.xml/pom.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-tutorial</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <packaging>bundle</packaging>
+
+ <artifactId>hello.client.xml</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>hello.service</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Private-Package>
+ ipojo.example.hello.client
+ </Private-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-ipojo-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>ipojo-bundle</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
diff --git a/ipojo/distributions/maven-tutorial/xml/hello.client.xml/src/main/java/ipojo/example/hello/client/HelloClient.java b/ipojo/distributions/maven-tutorial/xml/hello.client.xml/src/main/java/ipojo/example/hello/client/HelloClient.java
new file mode 100644
index 0000000..85e2ff5
--- /dev/null
+++ b/ipojo/distributions/maven-tutorial/xml/hello.client.xml/src/main/java/ipojo/example/hello/client/HelloClient.java
@@ -0,0 +1,90 @@
+/*
+ * 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 ipojo.example.hello.client;
+
+import ipojo.example.hello.Hello;
+
+/**
+ * Hello Service simple client.
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class HelloClient implements Runnable {
+
+ /**
+ * Delay between two invocations.
+ */
+ private static final int DELAY = 10000;
+
+ /**
+ * Hello services.
+ * Injected by the container.
+ * */
+ private Hello[] hellos; // Service dependency
+
+ /**
+ * End flag.
+ * */
+ private boolean end;
+
+ /**
+ * Name property.
+ * Injected by the container.
+ * */
+ private String name;
+
+ /**
+ * Run method.
+ * @see Runnable#run()
+ */
+ public void run() {
+ while (!end) {
+ try {
+ invokeHelloServices();
+ Thread.sleep(DELAY);
+ } catch (InterruptedException ie) {
+ /* will recheck end */
+ }
+ }
+ }
+
+ /**
+ * Invoke hello services.
+ */
+ public void invokeHelloServices() {
+ for (Hello hello : hellos) {
+ System.out.println(hello.sayHello(name));
+ }
+ }
+
+ /**
+ * Starting.
+ */
+ public void starting() {
+ Thread thread = new Thread(this);
+ end = false;
+ thread.start();
+ }
+
+ /**
+ * Stopping.
+ */
+ public void stopping() {
+ end = true;
+ }
+}
diff --git a/ipojo/distributions/maven-tutorial/xml/hello.client.xml/src/main/resources/metadata.xml b/ipojo/distributions/maven-tutorial/xml/hello.client.xml/src/main/resources/metadata.xml
new file mode 100644
index 0000000..3687ca4
--- /dev/null
+++ b/ipojo/distributions/maven-tutorial/xml/hello.client.xml/src/main/resources/metadata.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<ipojo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="org.apache.felix.ipojo http://felix.apache.org/ipojo/schemas/CURRENT/core.xsd"
+ xmlns="org.apache.felix.ipojo">
+ <component classname="ipojo.example.hello.client.HelloClient"
+ architecture="true">
+ <!-- Declare the service dependency -->
+ <requires field="hellos" />
+
+ <!-- Lifecycle callbacks -->
+ <callback transition="validate" method="starting" />
+ <callback transition="invalidate" method="stopping" />
+
+ <!-- A simple property coming from the instance configuration -->
+ <properties>
+ <property field="name" name="name" />
+ </properties>
+ </component>
+
+ <!--
+ Declaration of an instance of the component specified above.
+ Notice the instance property 'name' setting the value of the component's property
+ -->
+ <instance component="ipojo.example.hello.client.HelloClient">
+ <property name="name" value="iPOJO" />
+ </instance>
+
+</ipojo>
\ No newline at end of file
diff --git a/ipojo/distributions/maven-tutorial/xml/hello.felix.xml/pom.xml b/ipojo/distributions/maven-tutorial/xml/hello.felix.xml/pom.xml
new file mode 100644
index 0000000..136b908
--- /dev/null
+++ b/ipojo/distributions/maven-tutorial/xml/hello.felix.xml/pom.xml
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-tutorial</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>hello.felix.xml</artifactId>
+
+ <description>A project building a Felix with the XML Hello service and client</description>
+
+ <packaging>pom</packaging>
+
+ <dependencies>
+ <!-- our project -->
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>hello.service</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>hello.impl.xml</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>hello.client.xml</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.7</version>
+ <executions>
+
+ <execution>
+ <id>unpack-felix</id>
+ <phase>package</phase>
+ <goals>
+ <goal>unpack-dependencies</goal>
+ </goals>
+ <configuration>
+ <includeArtifactIds>org.apache.felix.main.distribution</includeArtifactIds>
+ <outputDirectory>${project.build.directory}</outputDirectory>
+ </configuration>
+ </execution>
+
+ <execution>
+ <id>copy-bundles</id>
+ <phase>package</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <includeArtifactIds>
+ hello.service,
+ hello.impl.xml,
+ hello.client.xml,
+ org.apache.felix.log,org.apache.felix.ipojo,
+ org.apache.felix.ipojo.arch.gogo
+ </includeArtifactIds>
+ <outputDirectory>${project.build.directory}/felix-framework-${felix.version}/bundle
+ </outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+
+
+</project>
\ No newline at end of file
diff --git a/ipojo/distributions/maven-tutorial/xml/hello.impl.xml/pom.xml b/ipojo/distributions/maven-tutorial/xml/hello.impl.xml/pom.xml
new file mode 100644
index 0000000..41eabf3
--- /dev/null
+++ b/ipojo/distributions/maven-tutorial/xml/hello.impl.xml/pom.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-tutorial</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>hello.impl.xml</artifactId>
+
+ <packaging>bundle</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>hello.service</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Private-Package>
+ ipojo.example.hello.impl
+ </Private-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-ipojo-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>ipojo-bundle</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
diff --git a/ipojo/distributions/maven-tutorial/xml/hello.impl.xml/src/main/java/ipojo/example/hello/impl/HelloImpl.java b/ipojo/distributions/maven-tutorial/xml/hello.impl.xml/src/main/java/ipojo/example/hello/impl/HelloImpl.java
new file mode 100644
index 0000000..6fd36e3
--- /dev/null
+++ b/ipojo/distributions/maven-tutorial/xml/hello.impl.xml/src/main/java/ipojo/example/hello/impl/HelloImpl.java
@@ -0,0 +1,36 @@
+/*
+ * 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 ipojo.example.hello.impl;
+
+import ipojo.example.hello.Hello;
+
+/**
+ * Component implementing the Hello service.
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class HelloImpl implements Hello {
+
+ /**
+ * Returns an 'Hello' message.
+ * @param name : name
+ * @return Hello message
+ * @see ipojo.example.hello.Hello#sayHello(String)
+ */
+ public String sayHello(String name) { return "hello " + name; }
+}
diff --git a/ipojo/distributions/maven-tutorial/xml/hello.impl.xml/src/main/resources/metadata.xml b/ipojo/distributions/maven-tutorial/xml/hello.impl.xml/src/main/resources/metadata.xml
new file mode 100644
index 0000000..59d9666
--- /dev/null
+++ b/ipojo/distributions/maven-tutorial/xml/hello.impl.xml/src/main/resources/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<iPOJO>
+ <component className="ipojo.example.hello.impl.HelloImpl"
+ name="HelloProvider" architecture="true">
+ <provides />
+ </component>
+ <instance component="HelloProvider" name="HelloService" />
+</iPOJO>
\ No newline at end of file