You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cl...@apache.org on 2008/01/10 16:47:59 UTC

svn commit: r610817 [2/2] - in /felix/sandbox/clement/ipojo: ./ annotations/ composite/src/main/java/org/apache/felix/ipojo/composite/ composite/src/main/java/org/apache/felix/ipojo/composite/instance/ composite/src/main/java/org/apache/felix/ipojo/com...

Added: felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandler/src/main/java/org/apache/felix/ipojo/handler/properties/PropertiesHandler.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandler/src/main/java/org/apache/felix/ipojo/handler/properties/PropertiesHandler.java?rev=610817&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandler/src/main/java/org/apache/felix/ipojo/handler/properties/PropertiesHandler.java (added)
+++ felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandler/src/main/java/org/apache/felix/ipojo/handler/properties/PropertiesHandler.java Thu Jan 10 07:47:47 2008
@@ -0,0 +1,269 @@
+package org.apache.felix.ipojo.handler.properties;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.Properties;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.ConfigurationException;
+import org.apache.felix.ipojo.PrimitiveHandler;
+import org.apache.felix.ipojo.architecture.HandlerDescription;
+import org.apache.felix.ipojo.metadata.Attribute;
+import org.apache.felix.ipojo.metadata.Element;
+import org.apache.felix.ipojo.parser.FieldMetadata;
+import org.apache.felix.ipojo.parser.ManipulationMetadata;
+
+/**
+ * This handler load a properties file containing property value. The handler injects this values inside fields.
+ * When stopping the handler stores updated value inside the file.
+ * The properties file contains [field-name: field-value] (field-value are strings)
+ * Metadata :  
+ * <example.handler.properties:properties file="file-path">
+ * Instances can override file locations by setting the properties.file property.
+ */
+public class PropertiesHandler extends PrimitiveHandler {
+    
+    /**
+     * Properties file.
+     */
+    Properties m_properties = new Properties();
+    
+    /**
+     * File location. 
+     */
+    String m_file;
+    
+    private final String NAMESPACE = "example.handler.properties";
+    
+    /**
+     * This method is the first to be invoked. This method aims to configure the handler.
+     * It receives the component type metadata and the instance description.
+     * The method parses given metadata and register field to listen.
+     * Step 3 : when the instance configuration contains the properties.file property, it overrides the properties file location.
+     * @param metadata : component type metadata
+     * @param configuration : instance description
+     * @throws ConfigurationException : the configuration of the handler has failed.
+     * @see org.apache.felix.ipojo.Handler#configure(org.apache.felix.ipojo.metadata.Element, java.util.Dictionary)
+     */
+    public void configure(Element metadata, Dictionary configuration) throws ConfigurationException {
+        // Parse metadata to get <properties file="$file"/>
+        
+        Element[] elem = metadata.getElements("properties", NAMESPACE); // Get all example.handler.properties:properties element
+        
+        switch(elem.length) {
+            case 0 : 
+                // No matching element in metadata, throw a configuration error.
+                new ConfigurationException("No properties found"); 
+            case 1 : 
+                // One 'properties' found, get attributes.
+                m_file = elem[0].getAttribute("file");
+                if (m_file == null) {
+                    // if file is null, throw a configuration error.
+                    new ConfigurationException("Malformed properties element : file attribute must be set"); 
+                }
+                break;
+            default : 
+                // To simplify we handle only one properties element.
+                new ConfigurationException("Only one properties element is supported");
+        } 
+        
+        // Look if the instance overrides file location :
+        String instanceFile = (String) configuration.get("properties.file");
+        if (instanceFile != null) {
+            m_file = instanceFile;
+        }
+        
+        // Load properties
+        try {
+            loadProperties();
+        } catch (IOException e) {
+            throw new ConfigurationException("Error when reading the " + m_file + " file : " + e.getMessage());
+        }
+        
+        // Register fields
+        // By convention, properties file entry are field name, so look for each property to get field list.
+        
+        //First get manipulation metadata :
+        ManipulationMetadata manipulation = new ManipulationMetadata(metadata);
+        FieldMetadata[] fields = new FieldMetadata[m_properties.size()]; // Array of field to register.
+        int i = 0;
+        Enumeration e = m_properties.keys();
+        while(e.hasMoreElements()) {
+            String field = (String) e.nextElement();
+            FieldMetadata fm = manipulation.getField(field);
+            
+            if (fm == null) { // The field does not exist
+                throw new ConfigurationException("The field " + field + " is declared in the properties file but does not exist in the pojo");
+            }
+            
+            // Then check that the field is a String field
+            if(!fm.getFieldType().equals(String.class.getName())) {
+                throw new ConfigurationException("The field " + field + " exists in the pojo, but is not a String");
+            }
+            
+            // All checks are ok, so add the field inside the array 
+            fields[i] = fm;
+            i++;
+        }
+        
+        // Finally register the field to listen 
+        getInstanceManager().register(this, fields, null);
+    }
+
+    /**
+     * This method is called when the instance start (after the configure method).
+     * We just print stored properties.
+     * @see org.apache.felix.ipojo.Handler#start()
+     */
+    public void start() {
+        // The properties are already loaded (in the configure method), just print values.
+        m_properties.list(System.out);
+    }
+
+    /**
+     * This method is called when the instance stops.
+     * We save the properties to not lost the instance state and clear the stored properties.
+     * @see org.apache.felix.ipojo.Handler#stop()
+     */
+    public void stop() { 
+        try {
+            saveProperties();
+        } catch (IOException e) {
+           error("Cannot read the file : " + m_file, e); // Log an error message by using the iPOJO logger
+        } 
+        m_properties = null;
+    }
+    
+    /**
+     * This method is called at each time the pojo 'get' a listened field.
+     * The method return the stored value.
+     * @param pojo : pojo object getting the field
+     * @param field : field name.
+     * @param o : previous value.
+     * @return the stored value.
+     * @see org.apache.felix.ipojo.PrimitiveHandler#getterCallback(java.lang.String, java.lang.Object)
+     */
+    public Object onGet(Object pojo, String field, Object o) {
+        // When the pojo requires a value for a managed field, this method is invoked.
+        // So, we have just to return the stored value.
+        return m_properties.get(field);
+    }
+    
+    /**
+     * This method is called at each time the pojo 'set' a listened field.
+     * This method updates the local properties.
+     * @param pojo : pojo object setting the field
+     * @param field : field name
+     * @param newvalue : new value
+     * @see org.apache.felix.ipojo.PrimitiveHandler#setterCallback(java.lang.String, java.lang.Object)
+     */
+    public void onSet(Object pojo, String field, Object newvalue) {
+        // When the pojo set a value to a managed field, this method is invoked.
+        // So, we update the stored value.
+        m_properties.put(field, newvalue);
+    }
+    
+    /**
+     * Step 2 : state properties when the instance becomes invalid.
+     * @param newState : the instance state
+     * @see org.apache.felix.ipojo.Handler#stateChanged(int)
+     */
+    public void stateChanged(int newState) {
+        // This method is invoked each times that the instance state changed.
+        
+        // If the new state is invalid, save the properties.
+        if (newState == ComponentInstance.INVALID) {
+            // Reload properties
+            try {
+                saveProperties();
+            } catch (IOException e) {
+               error("Cannot read the file : " + m_file, e); // Log an error message by using the iPOJO logger
+            } 
+            return;
+        }
+    }
+    
+    /**
+     * Step 5 : dynamic reconfiguration.
+     * This method is call when the instance is reconfigured externally.
+     * The given property contains property value.
+     * @param dict : new properties
+     * @see org.apache.felix.ipojo.Handler#reconfigure(java.util.Dictionary)
+     */
+    public synchronized void reconfigure(Dictionary dict) {
+        // For each property, look if a new value is contained in the new configuration.
+        Enumeration e = m_properties.keys();
+        while(e.hasMoreElements()) {
+            String field = (String) e.nextElement();
+            String value = (String) dict.get(field);
+            // If the dictionary contains a value, update the stored value.
+            if (value != null) {
+                m_properties.put(field, value);
+            }
+        }
+    }
+    
+    public HandlerDescription getDescription() {
+        return new Description(this);
+    }
+    
+    /**
+     * Helper method just loading the properties.
+     * @throws IOException : the file cannot be read.
+     */
+    private void loadProperties() throws IOException {
+        // Load the properties file from file system
+        File file = new File(m_file);
+        Reader reader = new FileReader(file);
+        m_properties.load(reader);
+    }
+    
+    /**
+     * Helper method writing properties.
+     * @throws IOException : the file cannot be written.
+     */
+    private void saveProperties() throws IOException {
+        // Store the file, modified the last modification date.
+        File file = new File(m_file);
+        Writer writer = new FileWriter(file);
+        m_properties.store(writer, "");
+    }
+    
+    /**
+     * Step 3 : The handler will participate to the instance architecture.
+     * Class describing the handler.
+     */
+    private class Description extends HandlerDescription {
+
+        public Description(PrimitiveHandler h) {
+            super(h);
+        }
+        
+        /**
+         * This method must return the Element describing the handler.
+         * The description of this handler contains the list of properties with attached value.
+         * @return the description of the handler.
+         * @see org.apache.felix.ipojo.architecture.HandlerDescription#getHandlerInfo()
+         */
+        public Element getHandlerInfo() {
+            Element elem = super.getHandlerInfo(); // This method must be called to get the root description element.
+            Enumeration e = m_properties.keys();
+            while(e.hasMoreElements()) {
+                String field = (String) e.nextElement();
+                Element prop = new Element("property", ""); // Create an element for the actual property.
+                // Add two attribute (the field and the value).
+                prop.addAttribute(new Attribute("field", field));
+                prop.addAttribute(new Attribute("value", (String) m_properties.get(field)));
+                elem.addElement(prop); // Attach the current element to the root element.
+            }
+            return elem;
+        }
+        
+    }
+}

Propchange: felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jan 10 07:47:47 2008
@@ -0,0 +1,5 @@
+target*
+.classpath*
+.setting*
+.project*
+bin*

Added: felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/metadata.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/metadata.xml?rev=610817&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/metadata.xml (added)
+++ felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/metadata.xml Thu Jan 10 07:47:47 2008
@@ -0,0 +1,17 @@
+<ipojo xmlns:props="example.handler.properties">
+
+<!-- Declare a component using your handler -->
+<component classname="org.apache.felix.ipojo.handler.properties.example.PropertiesTester">
+	<callback transition="validate" method="start"/>
+	<callback transition="invalidate" method="stop"/>
+	<!--  declare our handler -->
+	<props:properties file="props\properties.txt"/>
+</component>
+
+<!-- Declare an instance -->
+<instance component="annotationTester"/>
+<instance component="org.apache.felix.ipojo.handler.properties.example.PropertiesTester" name="i1">
+	<property name="properties.file" value="props\properties-i1.txt"/>
+</instance>
+
+</ipojo>

Added: felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/pom.xml?rev=610817&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/pom.xml (added)
+++ felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/pom.xml Thu Jan 10 07:47:47 2008
@@ -0,0 +1,60 @@
+<project>
+  <parent>
+    <groupId>org.apache.felix</groupId>
+    <artifactId>felix</artifactId>
+    <version>1.1.0-SNAPSHOT</version>
+    <relativePath>../../pom/pom.xml</relativePath>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <packaging>bundle</packaging>
+  <name>Apache Felix iPOJO Property Handler Test</name>
+  <version>0.7.6-SNAPSHOT</version>
+  <artifactId>org.apache.felix.ipojo.example.handler.property.test</artifactId>
+  <dependencies>
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>org.apache.felix.ipojo.annotations</artifactId>
+      <version>${pom.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>org.apache.felix.ipojo.example.handler.property</artifactId>
+      <version>${pom.version}</version>
+    </dependency>
+  </dependencies>
+  <build>
+  <plugins>
+  <plugin>
+		<groupId>org.apache.maven.plugins</groupId>
+		<artifactId>maven-compiler-plugin</artifactId>
+		<configuration>
+		<source>1.5</source>
+		<target>1.5</target>
+		</configuration>
+	  </plugin>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <version>1.1.0-SNAPSHOT</version>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Private-Package>org.apache.felix.ipojo.handler.properties.example</Private-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+      <plugin>
+	      <groupId>org.apache.felix</groupId>
+	      <artifactId>maven-ipojo-plugin</artifactId>
+              <version>${pom.version}</version>
+		  <executions>
+          	<execution>
+            	<goals>
+	              <goal>ipojo-bundle</goal>
+               </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+   </build>
+</project>

Propchange: felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/props/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jan 10 07:47:47 2008
@@ -0,0 +1,5 @@
+target*
+.classpath*
+.setting*
+.project*
+bin*

Added: felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/props/properties-i1.txt
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/props/properties-i1.txt?rev=610817&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/props/properties-i1.txt (added)
+++ felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/props/properties-i1.txt Thu Jan 10 07:47:47 2008
@@ -0,0 +1,4 @@
+#
+#Sun Nov 18 20:33:54 CET 2007
+property2=foo - 18 nov. 2007 20\:32\:55 - 18 nov. 2007 20\:33\:51
+property1=bar - 18 nov. 2007 20\:32\:55 - 18 nov. 2007 20\:33\:51

Added: felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/props/properties.txt
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/props/properties.txt?rev=610817&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/props/properties.txt (added)
+++ felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/props/properties.txt Thu Jan 10 07:47:47 2008
@@ -0,0 +1,4 @@
+#
+#Sun Nov 18 20:33:54 CET 2007
+property2=prop2 - 18 nov. 2007 20\:32\:55 - 18 nov. 2007 20\:33\:51
+property1=prop1 - 18 nov. 2007 20\:32\:55 - 18 nov. 2007 20\:33\:51

Propchange: felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/src/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jan 10 07:47:47 2008
@@ -0,0 +1,5 @@
+target*
+.classpath*
+.setting*
+.project*
+bin*

Propchange: felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/src/main/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jan 10 07:47:47 2008
@@ -0,0 +1,5 @@
+target*
+.classpath*
+.setting*
+.project*
+bin*

Propchange: felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/src/main/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jan 10 07:47:47 2008
@@ -0,0 +1,5 @@
+target*
+.classpath*
+.setting*
+.project*
+bin*

Propchange: felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/src/main/java/org/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jan 10 07:47:47 2008
@@ -0,0 +1,5 @@
+target*
+.classpath*
+.setting*
+.project*
+bin*

Propchange: felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/src/main/java/org/apache/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jan 10 07:47:47 2008
@@ -0,0 +1,5 @@
+target*
+.classpath*
+.setting*
+.project*
+bin*

Propchange: felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/src/main/java/org/apache/felix/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jan 10 07:47:47 2008
@@ -0,0 +1,5 @@
+target*
+.classpath*
+.setting*
+.project*
+bin*

Propchange: felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/src/main/java/org/apache/felix/ipojo/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jan 10 07:47:47 2008
@@ -0,0 +1,5 @@
+target*
+.classpath*
+.setting*
+.project*
+bin*

Propchange: felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/src/main/java/org/apache/felix/ipojo/handler/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jan 10 07:47:47 2008
@@ -0,0 +1,5 @@
+target*
+.classpath*
+.setting*
+.project*
+bin*

Propchange: felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/src/main/java/org/apache/felix/ipojo/handler/properties/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jan 10 07:47:47 2008
@@ -0,0 +1,5 @@
+target*
+.classpath*
+.setting*
+.project*
+bin*

Propchange: felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/src/main/java/org/apache/felix/ipojo/handler/properties/example/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jan 10 07:47:47 2008
@@ -0,0 +1,5 @@
+target*
+.classpath*
+.setting*
+.project*
+bin*

Added: felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/src/main/java/org/apache/felix/ipojo/handler/properties/example/AnnotationPropertiesTester.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/src/main/java/org/apache/felix/ipojo/handler/properties/example/AnnotationPropertiesTester.java?rev=610817&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/src/main/java/org/apache/felix/ipojo/handler/properties/example/AnnotationPropertiesTester.java (added)
+++ felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/src/main/java/org/apache/felix/ipojo/handler/properties/example/AnnotationPropertiesTester.java Thu Jan 10 07:47:47 2008
@@ -0,0 +1,44 @@
+package org.apache.felix.ipojo.handler.properties.example;
+
+import java.text.DateFormat;
+import java.util.Date;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Invalidate;
+import org.apache.felix.ipojo.annotations.Validate;
+
+import example.handler.properties.Properties;
+
+@Component(name="annotationTester")
+@Properties(file="props\\properties.txt")
+public class AnnotationPropertiesTester {
+    
+    // These two fields will be injected. 
+    private String property1;
+    private String property2;
+    
+    @Validate
+    public void start() {
+        System.out.println("AnnotationPropertiesTester is starting ...");
+        System.out.println("Property 1 : " + property1);
+        System.out.println("Property 2 : " + property2);
+        
+        updateProperties();
+    }
+    
+    @Invalidate
+    public void stop() {
+        System.out.println("AnnotationPropertiesTester is stopping ...");
+        System.out.println("Property 1 : " + property1);
+        System.out.println("Property 2 : " + property2);
+    }
+
+    private void updateProperties() {
+       System.out.println("Update properties");
+       Date date = new Date();
+       DateFormat df = DateFormat.getDateTimeInstance();
+       property1 = property1 + " - " + df.format(date);
+       property2 = property2 + " - " + df.format(date);
+        
+    }
+}

Added: felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/src/main/java/org/apache/felix/ipojo/handler/properties/example/PropertiesTester.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/src/main/java/org/apache/felix/ipojo/handler/properties/example/PropertiesTester.java?rev=610817&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/src/main/java/org/apache/felix/ipojo/handler/properties/example/PropertiesTester.java (added)
+++ felix/sandbox/clement/ipojo/examples/property-handler/PropertyHandlerTest/src/main/java/org/apache/felix/ipojo/handler/properties/example/PropertiesTester.java Thu Jan 10 07:47:47 2008
@@ -0,0 +1,50 @@
+package org.apache.felix.ipojo.handler.properties.example;
+
+import java.text.DateFormat;
+import java.util.Date;
+
+public class PropertiesTester {
+    
+    // These two fields will be injected. 
+    private String property1;
+    private String property2;
+    
+    /**
+     * Starting method.
+     * This method will be called when the instance starts.
+     */
+    public void start() {
+        System.out.println("PropertiesTester is starting ...");
+        // Read the injected properties.
+        System.out.println("Property 1 : " + property1);
+        System.out.println("Property 2 : " + property2);
+        
+        // Update the properties.
+        updateProperties();
+    }
+    
+    /**
+     * Stopping method.
+     * This method will be called when the instance stops.
+     */
+    public void stop() {
+        System.out.println("PropertiesTester is stopping ...");
+        System.out.println("Property 1 : " + property1);
+        System.out.println("Property 2 : " + property2);
+    }
+
+    /**
+     * This method just updates managed properties.
+     * It appends the current date to the actual property value.
+     */
+    private void updateProperties() {
+        System.out.println("Update properties");
+       Date date = new Date();
+       DateFormat df = DateFormat.getDateTimeInstance();
+       // The properties will be updated in the property file
+       property1 = property1 + " - " + df.format(date);
+       property2 = property2 + " - " + df.format(date);
+        
+    }
+
+}

Added: felix/sandbox/clement/ipojo/examples/property-handler/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/property-handler/pom.xml?rev=610817&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/property-handler/pom.xml (added)
+++ felix/sandbox/clement/ipojo/examples/property-handler/pom.xml Thu Jan 10 07:47:47 2008
@@ -0,0 +1,38 @@
+<project>
+  <parent>
+    <groupId>org.apache.felix</groupId>
+    <artifactId>felix</artifactId>
+    <version>1.1.0-SNAPSHOT</version>
+    <relativePath>../pom.xml</relativePath>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>ipojo.examples</groupId>
+  <artifactId>ipojo.examples.property.handler</artifactId>
+  <name>Apache Felix iPOJO Property Handler</name>
+  <version>0.7.6-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <profiles>
+	<profile>
+		<id>java5</id>
+		<activation>
+			<jdk>1.5</jdk>
+		</activation>
+		<modules>
+			<module>PropertyHandler</module>
+			<module>PropertyHandlerTest</module>
+		</modules>
+	</profile>
+	<profile>
+		<id>java6</id>
+		<activation>
+			<jdk>1.6</jdk>
+		</activation>
+		<modules>
+			<module>PropertyHandler</module>
+			<module>PropertyHandlerTest</module>
+		</modules>
+	</profile>
+  </profiles>
+</project>
\ No newline at end of file

Propchange: felix/sandbox/clement/ipojo/examples/tutorial-maven/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jan 10 07:47:47 2008
@@ -0,0 +1,5 @@
+.classpath
+.project
+.settings
+bin*
+target*

Propchange: felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jan 10 07:47:47 2008
@@ -0,0 +1,5 @@
+.classpath
+.project
+.settings
+bin*
+target*

Propchange: felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client.annotation/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jan 10 07:47:47 2008
@@ -0,0 +1,5 @@
+.classpath
+.project
+.settings
+bin*
+target*

Added: felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client.annotation/metadata.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client.annotation/metadata.xml?rev=610817&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client.annotation/metadata.xml (added)
+++ felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client.annotation/metadata.xml Thu Jan 10 07:47:47 2008
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<iPOJO>
+  <instance component="AnnotatedHelloClient" name="HelloClient"/>
+</iPOJO>
\ No newline at end of file

Added: felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client.annotation/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client.annotation/pom.xml?rev=610817&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client.annotation/pom.xml (added)
+++ felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client.annotation/pom.xml Thu Jan 10 07:47:47 2008
@@ -0,0 +1,66 @@
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <packaging>bundle</packaging>
+  <groupId>ipojo.example</groupId>
+  <artifactId>hello.client.annotation</artifactId>
+   <version>0.7.6-SNAPSHOT</version>
+  <name>Hello Service Client using Annotations</name>
+  
+  <dependencies>
+    <dependency>
+      <groupId>ipojo.example</groupId>
+      <artifactId>hello.service</artifactId>
+      <version>${pom.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.apache.felix.ipojo.annotations</artifactId>
+      <version>0.7.6-SNAPSHOT</version>
+    </dependency>
+  </dependencies>
+  
+  <pluginRepositories>
+    <pluginRepository>
+      <id>apache.snapshots</id>
+      <name>snapshot plugins</name>
+      <url>
+        http://people.apache.org/repo/m2-snapshot-repository
+      </url>
+    </pluginRepository>
+  </pluginRepositories>
+  
+  <build>
+    <plugins>
+     <plugin>
+		<groupId>org.apache.maven.plugins</groupId>
+		<artifactId>maven-compiler-plugin</artifactId>
+		<configuration>
+		<source>1.5</source>
+		<target>1.5</target>
+		</configuration>
+	  </plugin>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+            <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>

Added: felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client.annotation/src/main/java/ipojo/example/hello/client/HelloClient.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client.annotation/src/main/java/ipojo/example/hello/client/HelloClient.java?rev=610817&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client.annotation/src/main/java/ipojo/example/hello/client/HelloClient.java (added)
+++ felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client.annotation/src/main/java/ipojo/example/hello/client/HelloClient.java Thu Jan 10 07:47:47 2008
@@ -0,0 +1,38 @@
+package ipojo.example.hello.client;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Invalidate;
+import org.apache.felix.ipojo.annotations.Requires;
+import org.apache.felix.ipojo.annotations.Validate;
+
+import ipojo.example.hello.Hello;
+
+@Component(name="AnnotatedHelloClient", architecture=true)
+public class HelloClient implements Runnable {
+
+@Requires
+private Hello[] m_hello; // Service Dependency
+
+private final static int DELAY=10000;
+private boolean end;
+
+ public void run() {
+    while (!end) {
+               try {
+				invokeHelloServices();
+                Thread.sleep(DELAY);
+              } catch (InterruptedException ie) { }
+              /* will recheck end */
+     }
+}
+
+public void invokeHelloServices() {
+	for (int i = 0; i < m_hello.length; i++) { System.out.println(i + " :" + m_hello[i].sayHello("Clement")); }
+}
+
+ @Validate
+ public void starting() {    Thread T = new Thread(this);     end = false;     T.start();   }
+ 
+ @Invalidate
+ public void stopping() {    end = true;  }
+}
\ No newline at end of file

Added: felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client.annotation/src/main/java/ipojo/example/source.txt
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client.annotation/src/main/java/ipojo/example/source.txt?rev=610817&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client.annotation/src/main/java/ipojo/example/source.txt (added)
+++ felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client.annotation/src/main/java/ipojo/example/source.txt Thu Jan 10 07:47:47 2008
@@ -0,0 +1 @@
+PUT YOUR SOURCE FILES HERE
\ No newline at end of file

Added: felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client/metadata.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client/metadata.xml?rev=610817&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client/metadata.xml (added)
+++ felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client/metadata.xml Thu Jan 10 07:47:47 2008
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<iPOJO>
+  <component className="ipojo.example.hello.client.HelloClient" architecture="true">
+    <requires field="m_hello"/>
+    <callback transition="validate" method="starting"/>
+    <callback transition="invalidate" method="stopping"/>
+    <properties>
+    	<property field="m_name" name="name"/>
+    </properties>
+  </component>
+  <instance component="ipojo.example.hello.client.HelloClient" name="HelloClient">
+  	<property name="name" value="adriana"/>
+  </instance>
+    <instance component="ipojo.example.hello.client.HelloClient">
+  	<property name="name" value="francois"/>
+  </instance>
+</iPOJO>
\ No newline at end of file

Added: felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client/pom.xml?rev=610817&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client/pom.xml (added)
+++ felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client/pom.xml Thu Jan 10 07:47:47 2008
@@ -0,0 +1,60 @@
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <packaging>bundle</packaging><!-- Use the BND Maven plug-in -->
+  <groupId>ipojo.example</groupId>
+  <artifactId>hello.client</artifactId>
+   <version>0.7.6-SNAPSHOT</version>
+  <name>Hello Service Client</name>
+  <dependencies>
+    <dependency>
+      <groupId>ipojo.example</groupId>
+      <artifactId>hello.service</artifactId>
+      <version>${pom.version}</version>
+    </dependency>
+  </dependencies>
+  
+  <pluginRepositories>
+    <pluginRepository>
+      <id>apache.snapshots</id>
+      <name>snapshot plugins</name>
+      <url>
+        http://people.apache.org/repo/m2-snapshot-repository
+      </url>
+      <releases>
+        <enabled>false</enabled>
+      </releases>
+      <snapshots>
+        <enabled>true</enabled>
+      </snapshots>
+    </pluginRepository>
+  </pluginRepositories>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <version>1.1.0-SNAPSHOT</version>
+        <configuration>
+          <instructions>
+            <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+            <Private-Package>ipojo.example.hello.client</Private-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+      <plugin>
+	      <groupId>org.apache.felix</groupId>
+	      <artifactId>maven-ipojo-plugin</artifactId>
+	      <version>0.7.6-SNAPSHOT</version>
+		  <executions>
+          	<execution>
+            	<goals>
+	              <goal>ipojo-bundle</goal>
+               </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Added: felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client/src/main/java/ipojo/example/hello/client/HelloClient.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client/src/main/java/ipojo/example/hello/client/HelloClient.java?rev=610817&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client/src/main/java/ipojo/example/hello/client/HelloClient.java (added)
+++ felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client/src/main/java/ipojo/example/hello/client/HelloClient.java Thu Jan 10 07:47:47 2008
@@ -0,0 +1,29 @@
+package ipojo.example.hello.client;
+
+import ipojo.example.hello.Hello;
+
+public class HelloClient implements Runnable {
+
+private Hello[] m_hello; // Service Requirement
+private final static int DELAY=10000;
+private boolean end;
+
+private String m_name;
+
+ public void run() {
+    while (!end) {
+               try {
+				invokeHelloServices();
+                Thread.sleep(DELAY);
+              } catch (InterruptedException ie) { }
+              /* will recheck end */
+     }
+}
+
+public void invokeHelloServices() {
+	for (int i = 0; i < m_hello.length; i++) { System.out.println(m_hello[i].sayHello(m_name)); }
+}
+
+ public void starting() {    Thread T = new Thread(this);     end = false;     T.start();   }
+ public void stopping() {    end = true;  }
+}
\ No newline at end of file

Added: felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client/src/main/java/ipojo/example/source.txt
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client/src/main/java/ipojo/example/source.txt?rev=610817&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client/src/main/java/ipojo/example/source.txt (added)
+++ felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client/src/main/java/ipojo/example/source.txt Thu Jan 10 07:47:47 2008
@@ -0,0 +1 @@
+PUT YOUR SOURCE FILES HERE
\ No newline at end of file

Propchange: felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jan 10 07:47:47 2008
@@ -0,0 +1,5 @@
+.classpath
+.project
+.settings
+bin*
+target*

Propchange: felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl.annotation/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jan 10 07:47:47 2008
@@ -0,0 +1,5 @@
+.classpath
+.project
+.settings
+bin*
+target*

Added: felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl.annotation/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl.annotation/pom.xml?rev=610817&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl.annotation/pom.xml (added)
+++ felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl.annotation/pom.xml Thu Jan 10 07:47:47 2008
@@ -0,0 +1,65 @@
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <packaging>bundle</packaging>
+  <groupId>ipojo.example</groupId>
+  <artifactId>hello.impl.annotation</artifactId>
+  <version>0.7.6-SNAPSHOT</version>
+  <name>Hello Service Provider using Annotations</name>
+  
+  <pluginRepositories>
+    <pluginRepository>
+      <id>apache.snapshots</id>
+      <name>snapshot plugins</name>
+      <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+    </pluginRepository>
+  </pluginRepositories>
+  
+  <dependencies>
+   <dependency>
+      <groupId>ipojo.example</groupId>
+      <artifactId>hello.service</artifactId>
+      <version>${pom.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.apache.felix.ipojo.annotations</artifactId>
+      <version>0.7.6-SNAPSHOT</version>
+    </dependency>
+  </dependencies>
+  
+  <build>
+    <plugins>
+    <plugin>
+		<groupId>org.apache.maven.plugins</groupId>
+		<artifactId>maven-compiler-plugin</artifactId>
+		<configuration>
+		<source>1.5</source>
+		<target>1.5</target>
+		</configuration>
+	  </plugin>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+            <Private-Package>ipojo.example.hello.impl</Private-Package>
+            <Export-Package>ipojo.example.hello</Export-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>

Added: felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl.annotation/src/main/java/ipojo/example/hello/impl/HelloImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl.annotation/src/main/java/ipojo/example/hello/impl/HelloImpl.java?rev=610817&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl.annotation/src/main/java/ipojo/example/hello/impl/HelloImpl.java (added)
+++ felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl.annotation/src/main/java/ipojo/example/hello/impl/HelloImpl.java Thu Jan 10 07:47:47 2008
@@ -0,0 +1,15 @@
+package ipojo.example.hello.impl;
+
+import ipojo.example.hello.Hello;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Provides;
+
+/**
+  * Component implementing the Hello service.
+ **/
+@Component
+@Provides
+public class HelloImpl implements Hello {
+    public String sayHello(String name) { return "hello " + name + " @";  }
+}
\ No newline at end of file

Added: felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl.annotation/src/main/java/ipojo/example/hello/impl/source.txt
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl.annotation/src/main/java/ipojo/example/hello/impl/source.txt?rev=610817&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl.annotation/src/main/java/ipojo/example/hello/impl/source.txt (added)
+++ felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl.annotation/src/main/java/ipojo/example/hello/impl/source.txt Thu Jan 10 07:47:47 2008
@@ -0,0 +1 @@
+PUT YOUR SOURCE FILES HERE
\ No newline at end of file

Added: felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl.annotation/src/main/resources/metadata.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl.annotation/src/main/resources/metadata.xml?rev=610817&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl.annotation/src/main/resources/metadata.xml (added)
+++ felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl.annotation/src/main/resources/metadata.xml Thu Jan 10 07:47:47 2008
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<iPOJO>
+  <instance component="ipojo.example.hello.impl.HelloImpl" name="HelloService2"/>
+</iPOJO>
\ No newline at end of file

Added: felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl/metadata.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl/metadata.xml?rev=610817&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl/metadata.xml (added)
+++ felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl/metadata.xml Thu Jan 10 07:47:47 2008
@@ -0,0 +1,7 @@
+<?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

Added: felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl/pom.xml?rev=610817&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl/pom.xml (added)
+++ felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl/pom.xml Thu Jan 10 07:47:47 2008
@@ -0,0 +1,61 @@
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <packaging>bundle</packaging>
+  <groupId>ipojo.example</groupId>
+  <artifactId>hello.impl</artifactId>
+  <version>0.7.6-SNAPSHOT</version>
+  <name>Hello Service Provider</name>
+  
+   <pluginRepositories>
+    <pluginRepository>
+      <id>apache.snapshots</id>
+      <name>snapshot plugins</name>
+      <url>
+        http://people.apache.org/repo/m2-snapshot-repository
+      </url>
+      <releases>
+        <enabled>false</enabled>
+      </releases>
+      <snapshots>
+        <enabled>true</enabled>
+      </snapshots>
+    </pluginRepository>
+  </pluginRepositories>
+  
+  <dependencies>
+  	<dependency>
+  		<groupId>ipojo.example</groupId>
+  		<artifactId>hello.service</artifactId>
+  		<version>${pom.version}</version>
+  	</dependency>
+  </dependencies>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <version>1.1.0-SNAPSHOT</version>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+            <Private-Package>ipojo.example.hello.impl</Private-Package> 
+          </instructions>
+        </configuration>
+      </plugin>
+      <plugin>
+	      <groupId>org.apache.felix</groupId>
+	      <artifactId>maven-ipojo-plugin</artifactId>
+	      <version>0.7.6-SNAPSHOT</version>
+		  <executions>
+          	<execution>
+            	<goals>
+	              <goal>ipojo-bundle</goal>
+               </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Added: felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl/src/main/java/ipojo/example/hello/impl/HelloImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl/src/main/java/ipojo/example/hello/impl/HelloImpl.java?rev=610817&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl/src/main/java/ipojo/example/hello/impl/HelloImpl.java (added)
+++ felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl/src/main/java/ipojo/example/hello/impl/HelloImpl.java Thu Jan 10 07:47:47 2008
@@ -0,0 +1,10 @@
+package ipojo.example.hello.impl;
+
+import ipojo.example.hello.Hello;
+
+/**
+  * Component implementing the Hello service.
+ **/
+public class HelloImpl implements Hello {
+    public String sayHello(String name) { return "hello " + name;  }
+}
\ No newline at end of file

Added: felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl/src/main/java/ipojo/example/hello/impl/source.txt
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl/src/main/java/ipojo/example/hello/impl/source.txt?rev=610817&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl/src/main/java/ipojo/example/hello/impl/source.txt (added)
+++ felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl/src/main/java/ipojo/example/hello/impl/source.txt Thu Jan 10 07:47:47 2008
@@ -0,0 +1 @@
+PUT YOUR SOURCE FILES HERE
\ No newline at end of file

Propchange: felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.service/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jan 10 07:47:47 2008
@@ -0,0 +1,5 @@
+.classpath
+.project
+.settings
+bin*
+target*

Added: felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.service/metadata.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.service/metadata.xml?rev=610817&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.service/metadata.xml (added)
+++ felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.service/metadata.xml Thu Jan 10 07:47:47 2008
@@ -0,0 +1,7 @@
+<?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

Added: felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.service/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.service/pom.xml?rev=610817&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.service/pom.xml (added)
+++ felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.service/pom.xml Thu Jan 10 07:47:47 2008
@@ -0,0 +1,41 @@
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <packaging>bundle</packaging>
+  <groupId>ipojo.example</groupId>
+  <artifactId>hello.service</artifactId>
+  <version>0.7.6-SNAPSHOT</version>
+  <name>Hello Service</name>
+  
+   <pluginRepositories>
+    <pluginRepository>
+      <id>apache.snapshots</id>
+      <name>snapshot plugins</name>
+      <url>
+        http://people.apache.org/repo/m2-snapshot-repository
+      </url>
+      <releases>
+        <enabled>false</enabled>
+      </releases>
+      <snapshots>
+        <enabled>true</enabled>
+      </snapshots>
+    </pluginRepository>
+  </pluginRepositories>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <version>1.1.0-SNAPSHOT</version>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+            <Export-Package>ipojo.example.hello</Export-Package> 
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Added: felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.service/src/main/java/ipojo/example/hello/Hello.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.service/src/main/java/ipojo/example/hello/Hello.java?rev=610817&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.service/src/main/java/ipojo/example/hello/Hello.java (added)
+++ felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.service/src/main/java/ipojo/example/hello/Hello.java Thu Jan 10 07:47:47 2008
@@ -0,0 +1,9 @@
+package ipojo.example.hello;
+public interface Hello {
+/**
+   * Return a message like: "Hello $user_name"
+   * @param name: the name of the user
+   * @return the hello message
+ **/
+public String sayHello(String name);
+}
\ No newline at end of file

Added: felix/sandbox/clement/ipojo/examples/tutorial-maven/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/tutorial-maven/pom.xml?rev=610817&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/tutorial-maven/pom.xml (added)
+++ felix/sandbox/clement/ipojo/examples/tutorial-maven/pom.xml Thu Jan 10 07:47:47 2008
@@ -0,0 +1,36 @@
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>ipojo.examples</groupId>
+  <artifactId>ipojo.tutorial</artifactId>
+  <name>Apache Felix iPOJO Tutorial</name>
+  <version>0.7.6-SNAPSHOT</version>
+  <packaging>pom</packaging>
+  <modules>
+	<module>hello.service</module>
+	<module>hello.impl</module>
+	<module>hello.client</module>
+  </modules>
+  
+  <profiles>
+	<profile>
+		<id>java5</id>
+		<activation>
+			<jdk>1.5</jdk>
+		</activation>
+		<modules>
+			<module>hello.impl.annotation</module>
+			<module>hello.client.annotation</module>
+		</modules>
+	</profile>
+	<profile>
+		<id>java6</id>
+		<activation>
+			<jdk>1.6</jdk>
+		</activation>
+		<modules>
+			<module>hello.impl.annotation</module>
+			<module>hello.client.annotation</module>
+		</modules>
+	</profile>
+  </profiles>
+</project>
\ No newline at end of file

Modified: felix/sandbox/clement/ipojo/jmx.handler/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/jmx.handler/pom.xml?rev=610817&r1=610816&r2=610817&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo/jmx.handler/pom.xml (original)
+++ felix/sandbox/clement/ipojo/jmx.handler/pom.xml Thu Jan 10 07:47:47 2008
@@ -4,7 +4,7 @@
 	<groupId>org.apache.felix</groupId>
 	<artifactId>org.apache.felix.ipojo.handler.jmx</artifactId>
 	<version>0.7.6-SNAPSHOT</version>
-	<name>iPOJO JMX Handler</name>
+	<name>Apache Felix iPOJO JMX Handler</name>
 
 	<dependencies>
 		<dependency>

Modified: felix/sandbox/clement/ipojo/jmx.handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/MBeanHandler.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/jmx.handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/MBeanHandler.java?rev=610817&r1=610816&r2=610817&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo/jmx.handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/MBeanHandler.java (original)
+++ felix/sandbox/clement/ipojo/jmx.handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/MBeanHandler.java Thu Jan 10 07:47:47 2008
@@ -84,7 +84,7 @@
         Element[] attributes = mbeans[0].getElements("property");
         //String[] fields = new String[attributes.length];
         FieldMetadata[] fields = new FieldMetadata[attributes.length];
-        for (int i = 0 ; i < attributes.length ; i++) {
+        for (int i = 0 ; attributes != null && i < attributes.length ; i++) {
             boolean notif = false;
             String rights;
             String name;
@@ -123,7 +123,7 @@
         
         //set methods 
         Element[] methods = mbeans[0].getElements("method");
-        for (int i = 0 ; i < methods.length ; i++) {
+        for (int i = 0 ; methods != null && i < methods.length ; i++) {
             String name = methods[i].getAttribute("name");
             String description = null;
             if (methods[i].containsAttribute("description")) {

Modified: felix/sandbox/clement/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/FieldCollector.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/FieldCollector.java?rev=610817&r1=610816&r2=610817&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/FieldCollector.java (original)
+++ felix/sandbox/clement/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/FieldCollector.java Thu Jan 10 07:47:47 2008
@@ -279,7 +279,7 @@
             
             Element[] props = m_parent.getElements("Property");
             Element prop = null;
-            for (int i = 0; prop == null && i < props.length; i++) {
+            for (int i = 0; prop == null && props != null && i < props.length; i++) {
                 String name = props[i].getAttribute("name");
                 if (name != null && name.equals(m_name)) {
                     prop = props[i];

Modified: felix/sandbox/clement/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java?rev=610817&r1=610816&r2=610817&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java (original)
+++ felix/sandbox/clement/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java Thu Jan 10 07:47:47 2008
@@ -334,7 +334,7 @@
             }
             Element[] props = m_parent.getElements("Property");
             Element prop = null;
-            for (int i = 0; prop == null && i < props.length; i++) {
+            for (int i = 0; props != null && prop == null && i < props.length; i++) {
                 String name = props[i].getAttribute("name");
                 if (name != null && name.equals(m_name)) {
                     prop = props[i];

Modified: felix/sandbox/clement/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/XMLMetadataParser.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/XMLMetadataParser.java?rev=610817&r1=610816&r2=610817&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/XMLMetadataParser.java (original)
+++ felix/sandbox/clement/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/XMLMetadataParser.java Thu Jan 10 07:47:47 2008
@@ -38,62 +38,13 @@
     private Element[] m_elements = new Element[0];
 
     /**
-     * Get component type metadata. (both component and composite)
-     * 
-     * @return a components metadata
-     * @throws ParseException :  occurs in the xml parsing
-     */
-    public Element[] getComponentsMetadata() throws ParseException {
-        Element[] comp = m_elements[0].getElements("Component");
-        Element[] compo = m_elements[0].getElements("Composite");
-        Element[] handl = m_elements[0].getElements("Handler");
-        Element[] metadata = new Element[comp.length + compo.length + handl.length];
-        int l = 0;
-        for (int i = 0; i < comp.length; i++) {
-            metadata[l] = comp[i];
-            l++;
-        }
-        for (int i = 0; i < compo.length; i++) {
-            metadata[l] = compo[i];
-            l++;
-        }
-        for (int i = 0; i < handl.length; i++) {
-            metadata[l] = handl[i];
-            l++;
-        }
-        return metadata;
-    }
-
-    /**
      * Get parsed metadata.
      * The document must be parsed before calling this method. 
      * @return : all the metadata.
      * @throws ParseException : occurs if an error occurs during the parsing.
      */
     public Element[] getMetadata() throws ParseException {
-        Element[] comp = m_elements[0].getElements("Component");
-        Element[] compo = m_elements[0].getElements("Composite");
-        Element[] conf = m_elements[0].getElements("Instance");
-        Element[] handl = m_elements[0].getElements("Handler");
-        Element[] metadata = new Element[comp.length + conf.length + compo.length + handl.length];
-        int l = 0;
-        for (int i = 0; i < comp.length; i++) {
-            metadata[l] = comp[i];
-            l++;
-        }
-        for (int i = 0; i < compo.length; i++) {
-            metadata[l] = compo[i];
-            l++;
-        }
-        for (int i = 0; i < conf.length; i++) {
-            metadata[l] = conf[i];
-            l++;
-        }
-        for (int i = 0; i < handl.length; i++) {
-            metadata[l] = handl[i];
-            l++;
-        }
-        return metadata;
+        return m_elements[0].getElements();
     }
 
 

Modified: felix/sandbox/clement/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Element.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Element.java?rev=610817&r1=610816&r2=610817&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Element.java (original)
+++ felix/sandbox/clement/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Element.java Thu Jan 10 07:47:47 2008
@@ -83,7 +83,7 @@
                 list.add(v[i]);
             }
         }
-        return (Element[]) list.toArray(new Element[0]);
+        return (Element[]) list.toArray(new Element[list.size()]);
     }
 
     /**
@@ -223,22 +223,18 @@
     /**
      * Get the elements array of the element type given in parameter. This method look for an empty namespace.
      * @param name : the type of the element to find (element name)
-     * @return the resulting element array (empty if the search failed)
+     * @return the resulting element array (null if the search failed)
      */
     public Element[] getElements(String name) {
         Element[] elems = (Element[]) m_elements.get(name.toLowerCase());
-        if (elems == null) {
-            return new Element[0];
-        } else {
-            return elems;
-        }
+        return elems;
     }
 
     /**
      * Get the elements array of the element type given in parameter.
      * @param name : the type of the element to find (element name)
      * @param ns : the namespace of the element
-     * @return the resulting element array (empty if the search failed)
+     * @return the resulting element array (null if the search failed)
      */
     public Element[] getElements(String name, String ns) {
         if (ns == null || ns.equals("")) {
@@ -254,8 +250,7 @@
      * @return true if the element contains an element of the type "name"
      */
     public boolean containsElement(String name) {
-        name = name.toLowerCase();
-        return m_elements.containsKey(name);
+        return m_elements.containsKey(name.toLowerCase());
     }
 
     /**

Added: felix/sandbox/clement/ipojo/plugin/src/main/resources/archetype-resources/metadata.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/plugin/src/main/resources/archetype-resources/metadata.xml?rev=610817&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/plugin/src/main/resources/archetype-resources/metadata.xml (added)
+++ felix/sandbox/clement/ipojo/plugin/src/main/resources/archetype-resources/metadata.xml Thu Jan 10 07:47:47 2008
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<iPOJO>
+	<component className="$YOUR_COMPONENT_CLASS">
+   
+	</component>
+	<instance component="$YOUR_COMPONENT_CLASS"/>
+</iPOJO>
\ No newline at end of file

Modified: felix/sandbox/clement/ipojo/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/pom.xml?rev=610817&r1=610816&r2=610817&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo/pom.xml (original)
+++ felix/sandbox/clement/ipojo/pom.xml Thu Jan 10 07:47:47 2008
@@ -11,16 +11,46 @@
   <name>Apache Felix iPOJO</name>
   <version>0.7.6-SNAPSHOT</version>
   <packaging>pom</packaging>
-  <modules>
-	<module>metadata</module>
-    <module>manipulator</module>
-	<module>plugin</module>
-    <module>core</module>
-	<module>composite</module>
-    <module>arch</module>
-	<module>ant</module>
-	<module>event.admin.handler</module>
-	<module>white.board.pattern.handler</module>
-	<module>extender.pattern.handler</module>
-  </modules>
+  
+  	<modules>
+		<module>metadata</module>
+		<module>manipulator</module>
+		<module>plugin</module>
+		<module>core</module>
+		<module>composite</module>
+		<module>arch</module>
+		<module>ant</module>
+		<module>event.admin.handler</module>
+		<module>white.board.pattern.handler</module>
+		<module>extender.pattern.handler</module>
+	</modules>
+  
+  <profiles>
+	<profile>
+		<id>java5</id>
+		<activation>
+			<jdk>1.5</jdk>
+		</activation>
+		<modules>
+			<module>annotations</module>
+			<module>jmx.handler</module>
+		</modules>
+	</profile>
+	<profile>
+		<id>java6</id>
+		<activation>
+			<jdk>1.6</jdk>
+		</activation>
+		<modules>
+			<module>annotations</module>
+			<module>jmx.handler</module>
+		</modules>
+	</profile>
+	<profile>
+		<id>examples</id>
+		<modules>
+			<module>examples</module>
+		</modules>
+	</profile>
+  </profiles>
 </project>

Modified: felix/sandbox/clement/ipojo/white.board.pattern.handler/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/white.board.pattern.handler/pom.xml?rev=610817&r1=610816&r2=610817&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo/white.board.pattern.handler/pom.xml (original)
+++ felix/sandbox/clement/ipojo/white.board.pattern.handler/pom.xml Thu Jan 10 07:47:47 2008
@@ -1,7 +1,7 @@
 <project>
   <modelVersion>4.0.0</modelVersion>
   <packaging>bundle</packaging>
-  <name>Apache FelixiPOJO White Board Pattern Handler</name>
+  <name>Apache Felix iPOJO White Board Pattern Handler</name>
   <groupId>org.apache.felix</groupId>
   <version>0.7.6-SNAPSHOT</version>
   <artifactId>org.apache.felix.ipojo.handler.white.board.pattern</artifactId>