Remove old property handler example
Added distributions to the main iPOJO reactor
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1470278 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/examples/pom.xml b/ipojo/examples/pom.xml
index 412d598..3284bd7 100644
--- a/ipojo/examples/pom.xml
+++ b/ipojo/examples/pom.xml
@@ -26,25 +26,4 @@
<modules>
<module>tutorial-maven</module>
</modules>
-
- <profiles>
- <profile>
- <id>java5</id>
- <activation>
- <jdk>1.5</jdk>
- </activation>
- <modules>
- <module>property-handler</module>
- </modules>
- </profile>
- <profile>
- <id>java6</id>
- <activation>
- <jdk>1.6</jdk>
- </activation>
- <modules>
- <module>property-handler</module>
- </modules>
- </profile>
- </profiles>
</project>
\ No newline at end of file
diff --git a/ipojo/examples/property-handler/PropertyHandler/metadata.xml b/ipojo/examples/property-handler/PropertyHandler/metadata.xml
deleted file mode 100644
index 48d7bef..0000000
--- a/ipojo/examples/property-handler/PropertyHandler/metadata.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<ipojo xmlns:props="example.handler.properties">
-
- <!-- Declare the handler -->
- <handler name="properties" namespace="example.handler.properties"
- classname="org.apache.felix.ipojo.handler.properties.PropertiesHandler">
- <!-- the properties handler does not use any other handler -->
- </handler>
-
-</ipojo>
diff --git a/ipojo/examples/property-handler/PropertyHandler/pom.xml b/ipojo/examples/property-handler/PropertyHandler/pom.xml
deleted file mode 100644
index 6942760..0000000
--- a/ipojo/examples/property-handler/PropertyHandler/pom.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-<!--
- 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>
- <packaging>bundle</packaging>
- <name>Apache Felix iPOJO Property Handler</name>
- <artifactId>
- org.apache.felix.ipojo.example.handler.property
- </artifactId>
- <groupId>ipojo.examples</groupId>
- <version>1.5.0-SNAPSHOT</version>
- <dependencies>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.ipojo</artifactId>
- <version>1.9.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.ipojo.metadata</artifactId>
- <version>1.4.0</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.4.3</version>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Private-Package>
- org.apache.felix.ipojo.handler.properties,
- example.handler.properties
- </Private-Package>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-ipojo-plugin</artifactId>
- <version>1.9.0-SNAPSHOT</version>
- <executions>
- <execution>
- <goals>
- <goal>ipojo-bundle</goal>
- </goals>
- <configuration>
- <ignoreAnnotations>true</ignoreAnnotations>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/ipojo/examples/property-handler/PropertyHandler/src/main/java/example/handler/properties/Properties.java b/ipojo/examples/property-handler/PropertyHandler/src/main/java/example/handler/properties/Properties.java
deleted file mode 100644
index 9144bb8..0000000
--- a/ipojo/examples/property-handler/PropertyHandler/src/main/java/example/handler/properties/Properties.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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 example.handler.properties;
-
-/**
- * The Properties annotation.
- * This annotation may be used in POJO class to used the Property handler.
- * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
- */
-public @interface Properties {
-
- /**
- * Returns the property file used by the handler.
- */
- String file();
-
-}
diff --git a/ipojo/examples/property-handler/PropertyHandler/src/main/java/org/apache/felix/ipojo/handler/properties/PropertiesHandler.java b/ipojo/examples/property-handler/PropertyHandler/src/main/java/org/apache/felix/ipojo/handler/properties/PropertiesHandler.java
deleted file mode 100644
index abd3583..0000000
--- a/ipojo/examples/property-handler/PropertyHandler/src/main/java/org/apache/felix/ipojo/handler/properties/PropertiesHandler.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * 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 org.apache.felix.ipojo.handler.properties;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-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.PojoMetadata;
-
-/**
- * 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.
- * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
- */
-public class PropertiesHandler extends PrimitiveHandler {
-
- /** The Handler NAMESPACE. */
- private final String NAMESPACE = "example.handler.properties";
-
- /** Properties file. */
- private Properties m_properties = new Properties();
-
- /** File location. */
- private String m_file;
-
- /**
- * 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)
- */
- @SuppressWarnings("unchecked")
- 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.
- throw 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.
- throw new ConfigurationException("Malformed properties element : file attribute must be set");
- }
- break;
- default:
- // To simplify we handle only one properties element.
- throw 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 Pojo Metadata metadata :
- PojoMetadata pojoMeta = getPojoMetadata();
- Enumeration e = m_properties.keys();
- while (e.hasMoreElements()) {
- String field = (String) e.nextElement();
- FieldMetadata fm = pojoMeta.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, register the interceptor.
- getInstanceManager().register(fm, this);
- }
-
- // Finally register the field to listen
- }
-
- /**
- * 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)
- */
- @SuppressWarnings("unchecked")
- 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);
- }
- }
- }
-
- /**
- * Returns handler description.
- * @return the handler description.
- * @see org.apache.felix.ipojo.Handler#getDescription()
- */
- 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);
- InputStream is = new FileInputStream(file);
- m_properties.load(is);
- }
-
- /**
- * 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);
- OutputStream os = new FileOutputStream(file);
- m_properties.store(os, "");
- }
-
- /**
- * Step 3 : The handler will participate to the instance architecture.
- * This class describing the handler.
- */
- private class Description extends HandlerDescription {
-
- /**
- * Instantiates a new description.
- * @param h the h
- */
- 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()
- */
- @SuppressWarnings("unchecked")
- 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;
- }
-
- }
-}
diff --git a/ipojo/examples/property-handler/PropertyHandlerTest/metadata.xml b/ipojo/examples/property-handler/PropertyHandlerTest/metadata.xml
deleted file mode 100644
index dcc9c16..0000000
--- a/ipojo/examples/property-handler/PropertyHandlerTest/metadata.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<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>
diff --git a/ipojo/examples/property-handler/PropertyHandlerTest/pom.xml b/ipojo/examples/property-handler/PropertyHandlerTest/pom.xml
deleted file mode 100644
index 2627cec..0000000
--- a/ipojo/examples/property-handler/PropertyHandlerTest/pom.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-<!--
- 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>
- <packaging>bundle</packaging>
- <name>Apache Felix iPOJO Property Handler Test</name>
- <artifactId>
- org.apache.felix.ipojo.example.handler.property.test
- </artifactId>
- <groupId>ipojo.examples</groupId>
- <version>1.5.0-SNAPSHOT</version>
- <dependencies>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.ipojo.annotations</artifactId>
- <version>1.9.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>ipojo.examples</groupId>
- <artifactId>
- org.apache.felix.ipojo.example.handler.property
- </artifactId>
- <version>1.5.0-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>
- <version>1.4.3</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>1.9.0-SNAPSHOT</version>
- <executions>
- <execution>
- <goals>
- <goal>ipojo-bundle</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/ipojo/examples/property-handler/PropertyHandlerTest/props/properties-i1.txt b/ipojo/examples/property-handler/PropertyHandlerTest/props/properties-i1.txt
deleted file mode 100644
index 7d688d2..0000000
--- a/ipojo/examples/property-handler/PropertyHandlerTest/props/properties-i1.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-#Sun Nov 18 20:33:54 CET 2007
-m_property2=foo - 18 nov. 2007 20\:32\:55 - 18 nov. 2007 20\:33\:51
-m_property1=bar - 18 nov. 2007 20\:32\:55 - 18 nov. 2007 20\:33\:51
diff --git a/ipojo/examples/property-handler/PropertyHandlerTest/props/properties.txt b/ipojo/examples/property-handler/PropertyHandlerTest/props/properties.txt
deleted file mode 100644
index 2d46de8..0000000
--- a/ipojo/examples/property-handler/PropertyHandlerTest/props/properties.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-#Sun Nov 18 20:33:54 CET 2007
-m_property2=prop2 - 18 nov. 2007 20\:32\:55 - 18 nov. 2007 20\:33\:51
-m_property1=prop1 - 18 nov. 2007 20\:32\:55 - 18 nov. 2007 20\:33\:51
diff --git a/ipojo/examples/property-handler/PropertyHandlerTest/src/main/java/org/apache/felix/ipojo/handler/properties/example/AnnotationPropertiesTester.java b/ipojo/examples/property-handler/PropertyHandlerTest/src/main/java/org/apache/felix/ipojo/handler/properties/example/AnnotationPropertiesTester.java
deleted file mode 100644
index 0f3df8d..0000000
--- a/ipojo/examples/property-handler/PropertyHandlerTest/src/main/java/org/apache/felix/ipojo/handler/properties/example/AnnotationPropertiesTester.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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 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;
-
-/**
- * A simple component implementation using the property handler.
- *@author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
- */
-@Component(name = "annotationTester")
-@Properties(file = "props\\properties.txt")
-public class AnnotationPropertiesTester {
-
- /**
- * Property 1 : injected.
- */
- private String m_property1;
-
- /**
- * Property 1 : injected.
- */
- private String m_property2;
-
- /**
- * Start method :
- * displays loaded & injected properties before modifying them.
- */
- @Validate
- public void start() {
- System.out.println("AnnotationPropertiesTester is starting ...");
- System.out.println("Property 1 : " + m_property1);
- System.out.println("Property 2 : " + m_property2);
-
- updateProperties();
- }
-
- /**
- * Stop method :
- * displays properties values.
- */
- @Invalidate
- public void stop() {
- System.out.println("AnnotationPropertiesTester is stopping ...");
- System.out.println("Property 1 : " + m_property1);
- System.out.println("Property 2 : " + m_property2);
- }
-
- /**
- * Update property value.
- */
- private void updateProperties() {
- System.out.println("Update properties");
- Date date = new Date();
- DateFormat df = DateFormat.getDateTimeInstance();
- m_property1 = m_property1 + " - " + df.format(date);
- m_property2 = m_property2 + " - " + df.format(date);
-
- }
-}
diff --git a/ipojo/examples/property-handler/PropertyHandlerTest/src/main/java/org/apache/felix/ipojo/handler/properties/example/PropertiesTester.java b/ipojo/examples/property-handler/PropertyHandlerTest/src/main/java/org/apache/felix/ipojo/handler/properties/example/PropertiesTester.java
deleted file mode 100644
index 37872db..0000000
--- a/ipojo/examples/property-handler/PropertyHandlerTest/src/main/java/org/apache/felix/ipojo/handler/properties/example/PropertiesTester.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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 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);
-
- }
-
-}
diff --git a/ipojo/examples/property-handler/pom.xml b/ipojo/examples/property-handler/pom.xml
deleted file mode 100644
index fd3fa28..0000000
--- a/ipojo/examples/property-handler/pom.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<!--
- 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>
- <artifactId>ipojo.examples.property.handler</artifactId>
- <groupId>ipojo.examples</groupId>
- <version>1.1.0-SNAPSHOT</version>
- <name>Apache Felix iPOJO Property Handler</name>
- <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
diff --git a/ipojo/pom.xml b/ipojo/pom.xml
index eae697b..d4da67d 100644
--- a/ipojo/pom.xml
+++ b/ipojo/pom.xml
@@ -50,8 +50,8 @@
<module>arch-gogo</module>
<module>webconsole-plugin</module>
- <!-- junit4osgi -->
- <module>junit4osgi</module>
+ <!-- distribution and tutorials -->
+ <module>distributions</module>
</modules>
<profiles>