Return-Path: Delivered-To: apmail-felix-commits-archive@www.apache.org Received: (qmail 79676 invoked from network); 17 Apr 2009 14:46:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 17 Apr 2009 14:46:28 -0000 Received: (qmail 82382 invoked by uid 500); 17 Apr 2009 14:46:28 -0000 Delivered-To: apmail-felix-commits-archive@felix.apache.org Received: (qmail 82342 invoked by uid 500); 17 Apr 2009 14:46:28 -0000 Mailing-List: contact commits-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list commits@felix.apache.org Received: (qmail 82333 invoked by uid 99); 17 Apr 2009 14:46:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Apr 2009 14:46:28 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Apr 2009 14:46:27 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 320572388888; Fri, 17 Apr 2009 14:46:07 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r766037 - in /felix/trunk/ipojo: api/src/main/java/org/apache/felix/ipojo/api/ api/src/main/java/org/apache/felix/ipojo/api/composite/ tests/api/ tests/api/src/test/java/org/apache/felix/ipojo/tests/api/ tests/api/src/test/java/org/example/... Date: Fri, 17 Apr 2009 14:46:06 -0000 To: commits@felix.apache.org From: clement@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090417144607.320572388888@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: clement Date: Fri Apr 17 14:46:05 2009 New Revision: 766037 URL: http://svn.apache.org/viewvc?rev=766037&view=rev Log: The iPOJO API now supports external handlers. To use them, the handler provider has to implements HandlerConfiguration that returns the Element-Attribute structure representing the handler configuration. Added: felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/HandlerConfiguration.java (with props) felix/trunk/ipojo/tests/api/src/test/java/org/apache/felix/ipojo/tests/api/ExternalHandlerTest.java (with props) felix/trunk/ipojo/tests/api/src/test/java/org/apache/felix/ipojo/tests/api/Whiteboard.java (with props) felix/trunk/ipojo/tests/api/src/test/java/org/example/service/impl/HostImpl.java (with props) Modified: felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/ComponentType.java felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/Dependency.java felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/PrimitiveComponentType.java felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/Service.java felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/TemporalDependency.java felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/CompositeComponentType.java felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/ExportedService.java felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/ImportedService.java felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/Instance.java felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/InstantiatedService.java felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/ProvidedService.java felix/trunk/ipojo/tests/api/pom.xml Modified: felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/ComponentType.java URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/ComponentType.java?rev=766037&r1=766036&r2=766037&view=diff ============================================================================== --- felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/ComponentType.java (original) +++ felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/ComponentType.java Fri Apr 17 14:46:05 2009 @@ -43,6 +43,7 @@ * current component type. */ private List m_instances = new ArrayList(); + /** * Gets the factory attached to the current @@ -64,7 +65,7 @@ * component type. */ public abstract void stop(); - + /** * Creates a component instance from the current type @@ -189,9 +190,6 @@ } } } - - - } Modified: felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/Dependency.java URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/Dependency.java?rev=766037&r1=766036&r2=766037&view=diff ============================================================================== --- felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/Dependency.java (original) +++ felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/Dependency.java Fri Apr 17 14:46:05 2009 @@ -28,7 +28,7 @@ * Allows configuring a service dependencies. * @author Felix Project Team */ -public class Dependency { +public class Dependency implements HandlerConfiguration { /** * The dynamic binding policy. Added: felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/HandlerConfiguration.java URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/HandlerConfiguration.java?rev=766037&view=auto ============================================================================== --- felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/HandlerConfiguration.java (added) +++ felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/HandlerConfiguration.java Fri Apr 17 14:46:05 2009 @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.felix.ipojo.api; + +import org.apache.felix.ipojo.metadata.Element; + +/** + * Common interfaces for all contributions. + * @author Felix Project Team + */ +public interface HandlerConfiguration { + + /** + * Gets the Handler description. + * @return the Element-Attribute structure containing the handler + * configuration. + */ + public Element getElement(); + +} Propchange: felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/HandlerConfiguration.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/PrimitiveComponentType.java URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/PrimitiveComponentType.java?rev=766037&r1=766036&r2=766037&view=diff ============================================================================== --- felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/PrimitiveComponentType.java (original) +++ felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/PrimitiveComponentType.java Fri Apr 17 14:46:05 2009 @@ -125,6 +125,12 @@ private ArrayList m_temporals = new ArrayList(); /** + * List of Handler representing external + * handler configuration + */ + private List m_handlers = new ArrayList(); + + /** * Checks that the component type is not already * started. */ @@ -356,9 +362,28 @@ element.addElement(properties); } + // External handlers + for (int i = 0; i < m_handlers.size(); i++) { + HandlerConfiguration hc = (HandlerConfiguration) m_handlers.get(i); + element.addElement(hc.getElement()); + } + return element; } + + /** + * Adds an HandlerConfiguration to the component type. Each component type + * implementation must uses the populated list (m_handlers) when generating + * the component metadata. + * @param handler the handler configuration to add + * @return the current component type + */ + public PrimitiveComponentType addHandler(HandlerConfiguration handler) { + m_handlers.add(handler); + return this; + } + /** * Creates the component factory. */ Modified: felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/Service.java URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/Service.java?rev=766037&r1=766036&r2=766037&view=diff ============================================================================== --- felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/Service.java (original) +++ felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/Service.java Fri Apr 17 14:46:05 2009 @@ -33,7 +33,7 @@ * Allows configuring a provided service. * @author Felix Project Team */ -public class Service { +public class Service implements HandlerConfiguration { /** * Creation strategy : singleton (default). Modified: felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/TemporalDependency.java URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/TemporalDependency.java?rev=766037&r1=766036&r2=766037&view=diff ============================================================================== --- felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/TemporalDependency.java (original) +++ felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/TemporalDependency.java Fri Apr 17 14:46:05 2009 @@ -25,7 +25,7 @@ * Allows configuring a service dependencies. * @author Felix Project Team */ -public class TemporalDependency { +public class TemporalDependency implements HandlerConfiguration { /** * OnTimeout policy: nullable object. Modified: felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/CompositeComponentType.java URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/CompositeComponentType.java?rev=766037&r1=766036&r2=766037&view=diff ============================================================================== --- felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/CompositeComponentType.java (original) +++ felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/CompositeComponentType.java Fri Apr 17 14:46:05 2009 @@ -25,6 +25,7 @@ import org.apache.felix.ipojo.ConfigurationException; import org.apache.felix.ipojo.Factory; import org.apache.felix.ipojo.api.ComponentType; +import org.apache.felix.ipojo.api.HandlerConfiguration; import org.apache.felix.ipojo.composite.CompositeFactory; import org.apache.felix.ipojo.metadata.Attribute; import org.apache.felix.ipojo.metadata.Element; @@ -82,7 +83,16 @@ */ private boolean m_public = true; + /** + * Component type name. + */ private String m_name; + + /** + * List of Handler representing external + * handler configuration + */ + private List m_handlers = new ArrayList(); /** * Checks that the component type is not already @@ -199,6 +209,17 @@ } /** + * Adds an HandlerConfiguration to the component type. Each component type + * implementation must uses the populated list (m_handlers) when generating + * the component metadata. + * @param handler the handler configuration to add + * @return the current component type. + */ + public void CompositeComponentType(HandlerConfiguration handler) { + m_handlers.add(handler); + } + + /** * Generates the component description. * @return the component type description of * the current component type @@ -231,6 +252,13 @@ ProvidedService inst = (ProvidedService) m_provided.get(i); element.addElement(inst.getElement()); } + + // External handlers + for (int i = 0; i < m_handlers.size(); i++) { + HandlerConfiguration hc = (HandlerConfiguration) m_handlers.get(i); + element.addElement(hc.getElement()); + } + return element; } Modified: felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/ExportedService.java URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/ExportedService.java?rev=766037&r1=766036&r2=766037&view=diff ============================================================================== --- felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/ExportedService.java (original) +++ felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/ExportedService.java Fri Apr 17 14:46:05 2009 @@ -18,11 +18,12 @@ */ package org.apache.felix.ipojo.api.composite; +import org.apache.felix.ipojo.api.HandlerConfiguration; import org.apache.felix.ipojo.metadata.Attribute; import org.apache.felix.ipojo.metadata.Element; import org.apache.felix.ipojo.util.DependencyModel; -public class ExportedService { +public class ExportedService implements HandlerConfiguration { /** * The required specification. Modified: felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/ImportedService.java URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/ImportedService.java?rev=766037&r1=766036&r2=766037&view=diff ============================================================================== --- felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/ImportedService.java (original) +++ felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/ImportedService.java Fri Apr 17 14:46:05 2009 @@ -18,11 +18,12 @@ */ package org.apache.felix.ipojo.api.composite; +import org.apache.felix.ipojo.api.HandlerConfiguration; import org.apache.felix.ipojo.metadata.Attribute; import org.apache.felix.ipojo.metadata.Element; import org.apache.felix.ipojo.util.DependencyModel; -public class ImportedService { +public class ImportedService implements HandlerConfiguration { public static final String COMPOSITE_SCOPE = "composite"; Modified: felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/Instance.java URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/Instance.java?rev=766037&r1=766036&r2=766037&view=diff ============================================================================== --- felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/Instance.java (original) +++ felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/Instance.java Fri Apr 17 14:46:05 2009 @@ -28,10 +28,11 @@ import java.util.Vector; import java.util.Map.Entry; +import org.apache.felix.ipojo.api.HandlerConfiguration; import org.apache.felix.ipojo.metadata.Attribute; import org.apache.felix.ipojo.metadata.Element; -public class Instance { +public class Instance implements HandlerConfiguration { private String m_type; private List m_conf = new ArrayList(); Modified: felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/InstantiatedService.java URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/InstantiatedService.java?rev=766037&r1=766036&r2=766037&view=diff ============================================================================== --- felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/InstantiatedService.java (original) +++ felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/InstantiatedService.java Fri Apr 17 14:46:05 2009 @@ -28,11 +28,12 @@ import java.util.Vector; import java.util.Map.Entry; +import org.apache.felix.ipojo.api.HandlerConfiguration; import org.apache.felix.ipojo.metadata.Attribute; import org.apache.felix.ipojo.metadata.Element; import org.apache.felix.ipojo.util.DependencyModel; -public class InstantiatedService { +public class InstantiatedService implements HandlerConfiguration { /** * The required specification. Modified: felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/ProvidedService.java URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/ProvidedService.java?rev=766037&r1=766036&r2=766037&view=diff ============================================================================== --- felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/ProvidedService.java (original) +++ felix/trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/ProvidedService.java Fri Apr 17 14:46:05 2009 @@ -21,10 +21,11 @@ import java.util.ArrayList; import java.util.List; +import org.apache.felix.ipojo.api.HandlerConfiguration; import org.apache.felix.ipojo.metadata.Attribute; import org.apache.felix.ipojo.metadata.Element; -public class ProvidedService { +public class ProvidedService implements HandlerConfiguration { public static final String ALL_POLICY = "all"; public static final String ONE_POLICY = "one"; Modified: felix/trunk/ipojo/tests/api/pom.xml URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/api/pom.xml?rev=766037&r1=766036&r2=766037&view=diff ============================================================================== --- felix/trunk/ipojo/tests/api/pom.xml (original) +++ felix/trunk/ipojo/tests/api/pom.xml Fri Apr 17 14:46:05 2009 @@ -72,6 +72,12 @@ 1.3.0-SNAPSHOT + + + org.apache.felix + org.apache.felix.ipojo.handler.whiteboard + 1.3.0-SNAPSHOT +