Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ComponentBuilder.java URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ComponentBuilder.java?rev=1731476&r1=1731475&r2=1731476&view=diff ============================================================================== --- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ComponentBuilder.java (original) +++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ComponentBuilder.java Sat Feb 20 21:44:59 2016 @@ -1,3 +1,21 @@ +/* + * 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.dm.lambda; import java.util.Dictionary; @@ -14,12 +32,11 @@ import org.apache.felix.dm.lambda.callba import org.apache.felix.dm.lambda.callbacks.InstanceCbComponent; /** - * Builds a Dependency Manager Component. Components are the main building blocks for OSGi applications. + * Builds a Dependency Manager Component. <p> Components are the main building blocks for OSGi applications. * They can publish themselves as a service, and they can have dependencies. * These dependencies will influence their life cycle as component will only be activated when all - * required dependencies are available. - * - * <p> This interface is also the base interface for extended components like aspects, adapters, etc ... + * required dependencies are available. This interface is also the base interface for extended components like + * aspects, adapters, etc ... * * <p> Example of a component that depends on a ConfigurationAdmin service. The dependency is injected by reflection * on a class field which type matches the ConfigurationAdmin interface: @@ -51,7 +68,7 @@ public interface ComponentBuilder<B exte * a component. The factory itself can also be instantiated lazily by not specifying an instance, but a Class. * * @param factory the factory instance, or the factory class. - * @param createMethod the create method called on the factory in order to instantiate the component instance. + * @param createMethod the create method called on the factory in order to instantiate the component. * @return this builder */ B factory(Object factory, String createMethod); @@ -490,7 +507,7 @@ public interface ComponentBuilder<B exte * And once all extra dependencies will be available and injected, then the "start" callback will be invoked. * * @param <T> the type of the component class on which the callback is invoked on. - * @param callback a method reference must point to method from the component instance class(es). + * @param callback a method reference must point to method from the component implementation class(es). * @return this builder */ <T> B init(Cb<T> callback); @@ -501,7 +518,7 @@ public interface ComponentBuilder<B exte * invoked as part of the life cycle management of the component implementation. * * @param <T> the type of the component class on which the callback is invoked on. - * @param callback a method reference must point to method from one of the component instance classes. + * @param callback a method reference must point to method from one of the component implementation classes. * @return this builder. */ <T> B start(Cb<T> callback); @@ -512,7 +529,7 @@ public interface ComponentBuilder<B exte * invoked as part of the life cycle management of the component implementation. * * @param <T> the type of the component class on which the callback is invoked on. - * @param callback a method reference must point to method from one of the component instance classes. + * @param callback a method reference must point to method from one of the component implementation classes. * @return this builder. */ <T> B stop(Cb<T> callback); @@ -523,7 +540,7 @@ public interface ComponentBuilder<B exte * invoked as part of the life cycle management of the component implementation. * * @param <T> the type of the component class on which the callback is invoked on. - * @param callback a method reference must point to method from one of the component instance classes. + * @param callback a method reference must point to method from one of the component implementation classes. * @return this builder. */ <T> B destroy(Cb<T> callback); @@ -537,7 +554,7 @@ public interface ComponentBuilder<B exte * And once all extra dependencies will be available and injected, then the "start" callback will be invoked. * * @param <T> the type of the component class on which the callback is invoked on. - * @param callback a method reference must point to method from one of the component instance classes. The method takes as argument a Component parameter. + * @param callback a method reference must point to method from one of the component implementation classes. The method takes as argument a Component parameter. * @return this builder */ <T> B init(CbComponent<T> callback); @@ -548,7 +565,7 @@ public interface ComponentBuilder<B exte * invoked as part of the life cycle management of the component implementation. * * @param <T> the type of the component class on which the callback is invoked on. - * @param callback a method reference must point to method from one of the component instance classes. The method takes as argument a Component parameter. + * @param callback a method reference must point to method from one of the component implementation classes. The method takes as argument a Component parameter. * @return this builder. */ <T> B start(CbComponent<T> callback); @@ -559,7 +576,7 @@ public interface ComponentBuilder<B exte * invoked as part of the life cycle management of the component implementation. * * @param <T> the type of the component class on which the callback is invoked on. - * @param callback a method reference must point to method from one of the component instance classes. The method takes as argument a Component parameter. + * @param callback a method reference must point to method from one of the component implementation classes. The method takes as argument a Component parameter. * @return this builder. */ <T> B stop(CbComponent<T> callback); @@ -570,7 +587,7 @@ public interface ComponentBuilder<B exte * invoked as part of the life cycle management of the component implementation. * * @param <T> the type of the component class on which the callback is invoked on. - * @param callback a method reference must point to method from one of the component instance classes. The method takes as argument a Component parameter. + * @param callback a method reference must point to method from one of the component implementation classes. The method takes as argument a Component parameter. * @return this builder. */ <T> B destroy(CbComponent<T> callback); @@ -589,8 +606,8 @@ public interface ComponentBuilder<B exte B initInstance(InstanceCb callback); /** - * Sets an Object instance method reference used as the "start" callback. This method reference must point to method from one - * of the component instance classes. This method is invoked as part of the life cycle management of the component implementation. + * Sets an Object instance method reference used as the "start" callback. + * This method is invoked as part of the life cycle management of the component implementation. * The method does not take any parameters. * * @param callback an Object instance method reference. The method does not take any parameters. @@ -638,8 +655,8 @@ public interface ComponentBuilder<B exte B initInstance(InstanceCbComponent callback); /** - * Sets an Object instance method reference used as the "start" callback. This method reference must point to method from one - * of the component instance classes. This method is invoked as part of the life cycle management of the component implementation. + * Sets an Object instance method reference used as the "start" callback. + * This method is invoked as part of the life cycle management of the component implementation. * The method takes as argument a Component parameter. * * @param callback an Object instance method reference. The method takes as argument a Component parameter. @@ -648,8 +665,8 @@ public interface ComponentBuilder<B exte B startInstance(InstanceCbComponent callback); /** - * Sets an Object instance method reference used as the "stop" callback. This method reference must point to method from one - * of the component instance classes. This method is invoked as part of the life cycle management of the component implementation. + * Sets an Object instance method reference used as the "stop" callback. + * This method is invoked as part of the life cycle management of the component implementation. * The method takes as argument a Component parameter. * * @param callback an Object instance method reference. The method takes as argument a Component parameter. @@ -658,8 +675,8 @@ public interface ComponentBuilder<B exte B stopInstance(InstanceCbComponent callback); /** - * Sets an Object instance method reference used as the "destroy" callback. This method reference must point to method from one - * of the component instance classes. This method is invoked as part of the life cycle management of the component implementation. + * Sets an Object instance method reference used as the "destroy" callback. + * This method is invoked as part of the life cycle management of the component implementation. * The method takes as argument a Component parameter. * * @param callback an Object instance method reference. The method takes as argument a Component parameter. @@ -731,7 +748,7 @@ public interface ComponentBuilder<B exte * @return this builder */ B composition(Supplier<Object[]> getCompositionMethod); - + /** * Builds the real DependencyManager Component. * @return the real DependencyManager Component.
Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ConfigurationDependencyBuilder.java URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ConfigurationDependencyBuilder.java?rev=1731476&r1=1731475&r2=1731476&view=diff ============================================================================== --- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ConfigurationDependencyBuilder.java (original) +++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ConfigurationDependencyBuilder.java Sat Feb 20 21:44:59 2016 @@ -1,3 +1,21 @@ +/* + * 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.dm.lambda; import java.util.Collection; @@ -89,7 +107,7 @@ import org.apache.felix.dm.lambda.callba * public void init(BundleContext ctx, DependencyManager dm) throws Exception { * component(comp -> comp * .impl(ServiceImpl.class) - * .withConf(conf -> conf.update(MyConfig.class, ServiceImpl::modified))); + * .withCnf(conf -> conf.update(MyConfig.class, ServiceImpl::modified))); * } * } * }</pre> @@ -102,7 +120,7 @@ import org.apache.felix.dm.lambda.callba * public void init(BundleContext ctx, DependencyManager dm) throws Exception { * component(comp -> comp * .impl(ServiceImpl.class) - * .withConf(conf -> conf.pid("my.pid").update(ServiceImpl::modified))); + * .withCnf(conf -> conf.pid("my.pid").update(ServiceImpl::modified))); * } * } * }</pre> @@ -112,7 +130,7 @@ import org.apache.felix.dm.lambda.callba * <pre> {@code * public class Activator extends DependencyManagerActivator { * public void init(BundleContext ctx, DependencyManager dm) throws Exception { - * component(comp -> comp.impl(ServiceImpl.class).withConf("my.pid")); + * component(comp -> comp.impl(ServiceImpl.class).withCnf("my.pid")); * } * } * }</pre> @@ -122,7 +140,7 @@ import org.apache.felix.dm.lambda.callba * <pre> {@code * public class Activator extends DependencyManagerActivator { * public void init(BundleContext ctx, DependencyManager dm) throws Exception { - * component(comp -> comp.impl(ServiceImpl.class).withConf(conf -> conf.pid("my.pid").update("modified"))); + * component(comp -> comp.impl(ServiceImpl.class).withCnf(conf -> conf.pid("my.pid").update("modified"))); * } * } * }</pre> @@ -182,7 +200,7 @@ public interface ConfigurationDependency * </ol> * * @param configType the type of a configuration that is passed as argument to the callback - * @param updateMethod the callback to call on the component instance(s) when the configuration is updated. + * @param updateMethod the callback to call on the component implementation class(es) when the configuration is updated. * @return this builder */ ConfigurationDependencyBuilder update(Class<?> configType, String updateMethod); Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/DependencyBuilder.java URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/DependencyBuilder.java?rev=1731476&r1=1731475&r2=1731476&view=diff ============================================================================== --- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/DependencyBuilder.java (original) +++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/DependencyBuilder.java Sat Feb 20 21:44:59 2016 @@ -1,3 +1,21 @@ +/* + * 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.dm.lambda; import org.apache.felix.dm.Dependency; Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/DependencyManagerActivator.java URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/DependencyManagerActivator.java?rev=1731476&r1=1731475&r2=1731476&view=diff ============================================================================== --- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/DependencyManagerActivator.java (original) +++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/DependencyManagerActivator.java Sat Feb 20 21:44:59 2016 @@ -1,3 +1,21 @@ +/* + * 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.dm.lambda; import java.util.concurrent.CompletableFuture; Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/FactoryPidAdapterBuilder.java URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/FactoryPidAdapterBuilder.java?rev=1731476&r1=1731475&r2=1731476&view=diff ============================================================================== --- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/FactoryPidAdapterBuilder.java (original) +++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/FactoryPidAdapterBuilder.java Sat Feb 20 21:44:59 2016 @@ -1,3 +1,21 @@ +/* + * 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.dm.lambda; import org.apache.felix.dm.lambda.callbacks.CbConfiguration; @@ -10,7 +28,7 @@ import org.apache.felix.dm.lambda.callba import org.apache.felix.dm.lambda.callbacks.InstanceCbDictionaryComponent; /** - * Builds a Dependency Manager Factory Configuration Adapter Component. For each new Config Admin factory configuration matching the factoryPid, + * Builds a Dependency Manager Factory Configuration Adapter Component. <p> For each new Config Admin factory configuration matching a given factory pid, * an adapter will be created based on the adapter implementation class. The adapter will be registered with the specified interface, * and with the specified adapter service properties. Depending on the propagate parameter, every public factory configuration properties * (which don't start with ".") will be propagated along with the adapter service properties. @@ -81,9 +99,9 @@ public interface FactoryPidAdapterBuilde FactoryPidAdapterBuilder propagate(boolean propagate); /** - * Specifies a callback method that will be called on the component instances when the configuration is injected. + * Specifies a callback method that will be called on the component implementation when the configuration is injected. * - * @param updateMethod the method to call on the component instances when the configuration is available ("updated" by default). + * @param updateMethod the method to call on the component implementation when the configuration is available ("updated" by default). * * <p>The following method signatures are supported: * <ol> @@ -96,7 +114,7 @@ public interface FactoryPidAdapterBuilde FactoryPidAdapterBuilder update(String updateMethod); /** - * Sets a callback method to call on the component implementation class(es) when the configuration is updated. + * Sets a callback method to call on the component implementation when the configuration is updated. * The callback is invoked with a configuration type argument. * * <p>The following callback signatures are supported and searched in the following order: @@ -108,7 +126,7 @@ public interface FactoryPidAdapterBuilde * </ol> * * @param configType the type of a configuration that is passed as argument to the callback - * @param updateMethod the callback to call on the component instance(s) when the configuration is updated. + * @param updateMethod the callback to call on the component implementation when the configuration is updated. * @return this builder */ FactoryPidAdapterBuilder update(Class<?> configType, String updateMethod); Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/FluentProperty.java URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/FluentProperty.java?rev=1731476&r1=1731475&r2=1731476&view=diff ============================================================================== --- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/FluentProperty.java (original) +++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/FluentProperty.java Sat Feb 20 21:44:59 2016 @@ -1,3 +1,21 @@ +/* + * 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.dm.lambda; import org.apache.felix.dm.lambda.callbacks.SerializableLambda; Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/FutureDependencyBuilder.java URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/FutureDependencyBuilder.java?rev=1731476&r1=1731475&r2=1731476&view=diff ============================================================================== --- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/FutureDependencyBuilder.java (original) +++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/FutureDependencyBuilder.java Sat Feb 20 21:44:59 2016 @@ -1,3 +1,21 @@ +/* + * 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.dm.lambda; import java.util.concurrent.Executor; @@ -8,27 +26,30 @@ import org.apache.felix.dm.lambda.callba /** * Defines a builder for a CompletableFuture dependency. - * Using such dependency allows your component to wait for the completion of a given asynchronous task + * <p> Using such dependency allows your component to wait for the completion of a given asynchronous task * represented by a standard jdk <code>CompletableFuture</code> object. * * A FutureDependency is required and unblock the Component once the CompletableFuture result has completed. * * <h3>Usage Example</h3> * - * <p> Here is an Activator that downloads a page from the web and injects the string result to a component. + * <p> Here is an Activator that downloads a page from the web and injects the string result to the component before it is started. * When the web page is downloaded, the result is injected in the MyComponent::setPage method and * the component is then called in its "start" method: * * <pre>{@code * * public class Activator extends DependencyManagerActivator { - * public void init(BundleContext ctx, DependencyManager dm) throws Exception { + * public void init(BundleContext ctx, DependencyManager dm) throws Exception { + * // Download a web page asynchronously, using a CompletableFuture: + * * String url = "http://felix.apache.org/"; * CompletableFuture<String> page = CompletableFuture.supplyAsync(() -> downloadSite(url)); * * // The component depends on a log service and on the content of the Felix site. * // The lambda passed to the "withFuture" method configures the callback that is * // invoked with the result of the CompletableFuture (the page content). + * * component(comp -> comp * .impl(MyComponent.class) * .withService(LogService.class) @@ -54,8 +75,8 @@ import org.apache.felix.dm.lambda.callba */ public interface FutureDependencyBuilder<F> extends DependencyBuilder<Dependency> { /** - * Sets the callback method name to invoke on the component instances, once the CompletableFuture has completed. - * @param callback the callback method name to invoke on the component instances, once the CompletableFuture on which we depend has completed. + * Sets the callback method name to invoke on the component implementation, once the CompletableFuture has completed. + * @param callback the callback method name to invoke on the component implementation, once the CompletableFuture on which we depend has completed. * @return this dependency. */ FutureDependencyBuilder<F> complete(String callback); Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ServiceAdapterBuilder.java URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ServiceAdapterBuilder.java?rev=1731476&r1=1731475&r2=1731476&view=diff ============================================================================== --- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ServiceAdapterBuilder.java (original) +++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ServiceAdapterBuilder.java Sat Feb 20 21:44:59 2016 @@ -1,8 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.apache.felix.dm.lambda; /** * Builds a Dependency Manager Service Adapter Component. - * The adapter will be applied to any service that matches the specified interface and filter. For each matching service an adapter will be created + * <p> The adapter will be applied to any service that matches the specified interface and filter. For each matching service an adapter will be created * based on the adapter implementation class. The adapter will be registered with the specified interface and existing properties from the original * service plus any extra properties you supply here.<p> * Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ServiceAspectBuilder.java URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ServiceAspectBuilder.java?rev=1731476&r1=1731475&r2=1731476&view=diff ============================================================================== --- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ServiceAspectBuilder.java (original) +++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ServiceAspectBuilder.java Sat Feb 20 21:44:59 2016 @@ -1,8 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.apache.felix.dm.lambda; /** * Builds a Dependency Manager Aspect Component. - * The aspect will be applied to any service that matches the specified interface and filter (if any). For each matching service an aspect will be created based + * <p> The aspect will be applied to any service that matches the specified interface and filter (if any). For each matching service an aspect will be created based * on the aspect implementation class. * The aspect will be registered with the same interface and properties as the original service, plus any extra properties you supply here. * Multiple Aspects of the same service are chained and ordered using aspect ranks. Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ServiceCallbacksBuilder.java URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ServiceCallbacksBuilder.java?rev=1731476&r1=1731475&r2=1731476&view=diff ============================================================================== --- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ServiceCallbacksBuilder.java (original) +++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ServiceCallbacksBuilder.java Sat Feb 20 21:44:59 2016 @@ -1,3 +1,21 @@ +/* + * 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.dm.lambda; import org.apache.felix.dm.lambda.callbacks.CbRefServiceRefService; @@ -22,9 +40,10 @@ import org.apache.felix.dm.lambda.callba import org.apache.felix.dm.lambda.callbacks.InstanceCbServiceServiceComponent; /** - * Builds a service dependency callback (required by default). + * Builds a service dependency callback. When a service dependency is not explicitly defined as "required" or "optional", + * then it is assumed to be required by default. * - * A Service may be injected in a bind-method of a component or an object instance using this builder. + * <p> A Service may be injected in a bind-method of a component or an object instance using this builder. * The builder supports reflection based callbacks (same as with the original DM API), as well as java8 method reference based callbacks. * * <p> <b> List of signatures supported using reflection based callbacks (same as original DM API): </b> @@ -104,8 +123,8 @@ public interface ServiceCallbacksBuilder B callbackInstance(Object callbackInstance); /** - * Sets <code>callback</code> methods to invoke when a service is added. When a service matches the service - * filter, then the service is injected using the specified callback method. The callback is invoked on the component instances, or on the callback + * Sets a <code>callback</code> method to invoke when a service is added. When a service matches the service + * filter, then the service is injected using the specified callback method. The callback is invoked on the component implementation, or on the callback * instance, is specified using the {@link #callbackInstance(Object)} method. * * The following method signature are supported: @@ -128,8 +147,8 @@ public interface ServiceCallbacksBuilder B add(String callback); /** - * Sets <code>callback</code> methods to invoke when a service is changed. When a changed service matches the service - * filter, then the service is injected using the specified callback method. The callback is invoked on the component instances, or on the callback + * Sets a <code>callback</code> methods to invoke when a service is changed. When a changed service matches the service + * filter, then the service is injected using the specified callback method. The callback is invoked on the component implementation, or on the callback * instance, is specified using the {@link #callbackInstance(Object)} method. * * The following method signature are supported: @@ -152,8 +171,8 @@ public interface ServiceCallbacksBuilder B change(String callback); /** - * Sets <code>callback</code> methods to invoke when a service is removed. When a removed service matches the service - * filter, then the specified callback in invoked with the removed service. The callback is invoked on the component instances, or on the callback + * Sets a <code>callback</code> method to invoke when a service is removed. When a removed service matches the service + * filter, then the specified callback in invoked with the removed service. The callback is invoked on the component implementation, or on the callback * instance, is specified using the {@link #callbackInstance(Object)} method. * * The following method signature are supported: @@ -176,7 +195,7 @@ public interface ServiceCallbacksBuilder B remove(String callback); /** - * Sets <code>callback</code> methods to invoke when a service is swapped. The callback is invoked on the component instances, or on the callback + * Sets a <code>callback</code> method to invoke when a service is swapped. The callback is invoked on the component implementation, or on the callback * instance, is specified using the {@link #callbackInstance(Object)} method. * * The following method signature are supported: @@ -194,186 +213,186 @@ public interface ServiceCallbacksBuilder B swap(String callback); /** - * Sets a <code>component instance callback(Service)</code> callback. The callback is invoked when a service is added. + * Sets a <code>component callback(Service)</code> method reference. The callback is invoked when a service is added. * The method reference must point to a Component implementation class method. * - * @param <T> the type of the component instance class on which the callback is invoked. + * @param <T> the type of the component implementation class on which the callback is invoked. * @param add the method reference invoked when a service is added. * @return this builder */ <T> B add(CbService<T, S> add); /** - * Sets a <code>component instance callback(Service)</code> callback. The callback is invoked when a service is changed. + * Sets a <code>component callback(Service)</code> method reference. The callback is invoked when a service is changed. * The method reference must point to a Component implementation class method. * - * @param <T> the type of the component instance class on which the callback is invoked. + * @param <T> the type of the component implementation class on which the callback is invoked. * @param change the method reference invoked when a service is changed. * @return this builder */ <T> B change(CbService<T, S> change); /** - * Sets a <code>component instance callback(Service)</code> callback. The callback is invoked when a service is removed. + * Sets a <code>component callback(Service)</code> method reference. The callback is invoked when a service is removed. * The method reference must point to a Component implementation class method. * - * @param <T> the type of the component instance class on which the callback is invoked. + * @param <T> the type of the component implementation class on which the callback is invoked. * @param remove the method reference invoked when a service is removed. * @return this builder */ <T> B remove(CbService<T, S> remove); /** - * Sets a {@code component instance callback(Service, Map<String, Object>)} callback. The callback is invoked when a service is added. + * Sets a {@code component callback(Service, Map<String, Object>)} method reference. The callback is invoked when a service is added. * The method reference must point to a Component implementation class method. * - * @param <T> the type of the component instance class on which the callback is invoked. + * @param <T> the type of the component implementation class on which the callback is invoked. * @param add the method reference invoked when a service is added. * @return this builder */ <T> B add(CbServiceMap<T, S> add); /** - * Sets a {@code component instance callback(Service, Map<String, Object>)} callback. The callback is invoked when a service is changed. + * Sets a {@code component callback(Service, Map<String, Object>)} method reference. The callback is invoked when a service is changed. * The method reference must point to a Component implementation class method. * - * @param <T> the type of the component instance class on which the callback is invoked. + * @param <T> the type of the component implementation class on which the callback is invoked. * @param change the method reference invoked when a service is changed. * @return this builder */ <T> B change(CbServiceMap<T, S> change); /** - * Sets a {@code component instance callback(Service, Map<String, Object></code>)} callback. The callback is invoked when a service is removed. + * Sets a {@code component callback(Service, Map<String, Object></code>)} method reference. The callback is invoked when a service is removed. * The method reference must point to a Component implementation class method. * - * @param <T> the type of the component instance class on which the callback is invoked. + * @param <T> the type of the component implementation class on which the callback is invoked. * @param remove the method reference invoked when a service is removed. * @return this builder */ <T> B remove(CbServiceMap<T, S> remove); /** - * Sets a {@code component instance callback(Service, Dictionary<String, Object>)} callback. The callback is invoked when a service is added. + * Sets a {@code component callback(Service, Dictionary<String, Object>)} method reference. The callback is invoked when a service is added. * The method reference must point to a Component implementation class method. * - * @param <T> the type of the component instance class on which the callback is invoked. + * @param <T> the type of the component implementation class on which the callback is invoked. * @param add the method reference invoked when a service is added. * @return this builder */ <T> B add(CbServiceDict<T, S> add); /** - * Sets a {@code component instance callback(Service, Dictionary<String, Object>)} callback. The callback is invoked when a service is changed. + * Sets a {@code component callback(Service, Dictionary<String, Object>)} method reference. The callback is invoked when a service is changed. * The method reference must point to a Component implementation class method. * - * @param <T> the type of the component instance class on which the callback is invoked. + * @param <T> the type of the component implementation class on which the callback is invoked. * @param change the method reference invoked when a service is changed. * @return this builder */ <T> B change(CbServiceDict<T, S> change); /** - * Sets a {@code component instance callback(Service, Dictionary<String, Object>)} callback. The callback is invoked when a service is removed. + * Sets a {@code component callback(Service, Dictionary<String, Object>)} method reference. The callback is invoked when a service is removed. * The method reference must point to a Component implementation class method. * - * @param <T> the type of the component instance class on which the callback is invoked. + * @param <T> the type of the component implementation class on which the callback is invoked. * @param remove the method reference invoked when a service is removed. * @return this builder */ <T> B remove(CbServiceDict<T, S> remove); /** - * Sets a <code>component instance callback(Service, ServiceReference)</code> callback. The callback is invoked when a service is added. + * Sets a <code>component callback(Service, ServiceReference)</code> method reference. The callback is invoked when a service is added. * The method reference must point to a Component implementation class method. - * @param <T> the type of the component instance class on which the callback is invoked. + * @param <T> the type of the component implementation class on which the callback is invoked. * @param add the method reference invoked when a service is added. * @return this builder */ <T> B add(CbServiceRef<T, S> add); /** - * Sets a <code>component instance callback(Service, ServiceReference)</code> callback. The callback is invoked when a service is changed. + * Sets a <code>component callback(Service, ServiceReference)</code> method reference. The callback is invoked when a service is changed. * The method reference must point to a Component implementation class method. * - * @param <T> the type of the component instance class on which the callback is invoked. + * @param <T> the type of the component implementation class on which the callback is invoked. * @param change the method reference invoked when a service is changed. * @return this builder */ <T> B change(CbServiceRef<T, S> change); /** - * Sets a <code>component instance callback(Service, ServiceReference)</code> callback. The callback is invoked when a service is removed. + * Sets a <code>component callback(Service, ServiceReference)</code> method reference. The callback is invoked when a service is removed. * The method reference must point to a Component implementation class method. * - * @param <T> the type of the component instance class on which the callback is invoked. + * @param <T> the type of the component implementation class on which the callback is invoked. * @param remove the method reference invoked when a service is removed. * @return this builder */ <T> B remove(CbServiceRef<T, S> remove); /** - * Sets a <code>component instance callback(Service, Component)</code> callback. The callback is invoked when a service is added. + * Sets a <code>component callback(Service, Component)</code> method reference. The callback is invoked when a service is added. * The method reference must point to a Component implementation class method. * - * @param <T> the type of the component instance class on which the callback is invoked. + * @param <T> the type of the component implementation class on which the callback is invoked. * @param add the method reference invoked when a service is added. * @return this builder */ <T> B add(CbServiceComponent<T, S> add); /** - * Sets a <code>component instance callback(Service, Component)</code> callback. The callback is invoked when a service is changed. + * Sets a <code>component callback(Service, Component)</code> method reference. The callback is invoked when a service is changed. * The method reference must point to a Component implementation class method. * - * @param <T> the type of the component instance class on which the callback is invoked. + * @param <T> the type of the component implementation class on which the callback is invoked. * @param change the method reference invoked when a service is changed. * @return this builder */ <T> B change(CbServiceComponent<T, S> change); /** - * Sets a <code>component instance callback(Service, Component)</code> callback. The callback is invoked when a service is removed. + * Sets a <code>component callback(Service, Component)</code> method reference. The callback is invoked when a service is removed. * The method reference must point to a Component implementation class method. * - * @param <T> the type of the component instance class on which the callback is invoked. + * @param <T> the type of the component implementation class on which the callback is invoked. * @param remove the method reference invoked when a service is removed. * @return this builder */ <T> B remove(CbServiceComponent<T, S> remove); /** - * Sets a <code>component instance callback(Service, Component, ServiceReference ref)</code> callback. The callback is invoked when a service is added. + * Sets a <code>component callback(Service, Component, ServiceReference ref)</code> method reference. The callback is invoked when a service is added. * The method reference must point to a Component implementation class method. * - * @param <T> the type of the component instance class on which the callback is invoked. + * @param <T> the type of the component implementation class on which the callback is invoked. * @param add the method reference invoked when a service is added. * @return this builder */ <T> B add(CbServiceComponentRef<T, S> add); /** - * Sets a <code>component instance callback(Service, Component, ServiceReference)</code> callback. The callback is invoked when a service is changed. + * Sets a <code>component callback(Service, Component, ServiceReference)</code> method reference. The callback is invoked when a service is changed. * The method reference must point to a Component implementation class method. * - * @param <T> the type of the component instance class on which the callback is invoked. + * @param <T> the type of the component implementation class on which the callback is invoked. * @param change the method reference invoked when a service is changed. * @return this builder */ <T> B change(CbServiceComponentRef<T, S> change); /** - * Sets a <code>component instance callback(Service, Component, ServiceReference)</code> callback. The callback is invoked when a service is removed. + * Sets a <code>component callback(Service, Component, ServiceReference)</code> method reference. The callback is invoked when a service is removed. * The method reference must point to a Component implementation class method. * - * @param <T> the type of the component instance class on which the callback is invoked. + * @param <T> the type of the component implementation class on which the callback is invoked. * @param remove the method reference invoked when a service is removed. * @return this builder */ <T> B remove(CbServiceComponentRef<T, S> remove); /** - * Sets an <code>object instance callback(Service)</code> callback. The callback is invoked when a service is added. + * Sets an <code>Object instance callback(Service)</code> method reference. The callback is invoked when a service is added. * The method reference must point to a method from an Object instance. * * @param add the method reference invoked when a service is added. @@ -382,7 +401,7 @@ public interface ServiceCallbacksBuilder B add(InstanceCbService<S> add); /** - * Sets an <code>object instance callback(Service)</code> callback. The callback is invoked when a service is changed. + * Sets an <code>Object instance callback(Service)</code> method reference. The callback is invoked when a service is changed. * The method reference must point to method from an Object instance. * * @param change the method reference invoked when a service is changed. @@ -391,7 +410,7 @@ public interface ServiceCallbacksBuilder B change(InstanceCbService<S> change); /** - * Sets an <code>object instance callback(Service)</code> callback. The callback is invoked when a service is removed. + * Sets an <code>Object instance callback(Service)</code> method reference. The callback is invoked when a service is removed. * The method reference must point to method from an Object instance. * * @param remove the method reference invoked when a service is removed. @@ -400,7 +419,7 @@ public interface ServiceCallbacksBuilder B remove(InstanceCbService<S> remove); /** - * Sets an {@code object instance callback(Service, Map<String, Object>)} callback. The callback is invoked when a service is added. + * Sets an {@code Object instance callback(Service, Map<String, Object>)} method reference. The callback is invoked when a service is added. * The method reference must point to a method from an Object instance. * * @param add the method reference invoked when a service is added. @@ -409,7 +428,7 @@ public interface ServiceCallbacksBuilder B add(InstanceCbServiceMap<S> add); /** - * Sets an {@code object instance callback(Service, Map<String, Object>)} callback. The callback is invoked when a service is changed. + * Sets an {@code Object instance callback(Service, Map<String, Object>)} method reference. The callback is invoked when a service is changed. * The method reference must point to method from an Object instance. * * @param change the method reference invoked when a service is changed. @@ -418,7 +437,7 @@ public interface ServiceCallbacksBuilder B change(InstanceCbServiceMap<S> change); /** - * Sets an {@code object instance callback(Service, Map<String, Object>)} callback. The callback is invoked when a service is removed. + * Sets an {@code Object instance callback(Service, Map<String, Object>)} method reference. The callback is invoked when a service is removed. * The method reference must point to method from an Object instance. * * @param remove the method reference invoked when a service is removed. @@ -427,7 +446,7 @@ public interface ServiceCallbacksBuilder B remove(InstanceCbServiceMap<S> remove); /** - * Sets an {@code object instance callback(Service svc, Dictionary<String, Object>} callback. The callback is invoked when a service is added. + * Sets an {@code Object instance callback(Service svc, Dictionary<String, Object>} method reference. The callback is invoked when a service is added. * The method reference must point to a method from an Object instance. * * @param add the method reference invoked when a service is added. @@ -436,7 +455,7 @@ public interface ServiceCallbacksBuilder B add(InstanceCbServiceDict<S> add); /** - * Sets an {@code object instance callback(Service, Dictionary<String, Object>)} callback. The callback is invoked when a service is changed. + * Sets an {@code Object instance callback(Service, Dictionary<String, Object>)} method reference. The callback is invoked when a service is changed. * The method reference must point to method from an Object instance. * * @param change the method reference invoked when a service is changed. @@ -445,7 +464,7 @@ public interface ServiceCallbacksBuilder B change(InstanceCbServiceDict<S> change); /** - * Sets an {@code object instance callback(Service, Dictionary<String, Object>)} callback. The callback is invoked when a service is removed. + * Sets an {@code Object instance callback(Service, Dictionary<String, Object>)} method reference. The callback is invoked when a service is removed. * The method reference must point to method from an Object instance. * * @param remove the method reference invoked when a service is removed. @@ -454,7 +473,7 @@ public interface ServiceCallbacksBuilder B remove(InstanceCbServiceDict<S> remove); /** - * Sets an <code>object instance callback(Service, ServiceReference)</code> callback. The callback is invoked when a service is added. + * Sets an <code>Object instance callback(Service, ServiceReference)</code> method reference. The callback is invoked when a service is added. * The method reference must point to a method from an Object instance. * * @param add the method reference invoked when a service is added. @@ -463,7 +482,7 @@ public interface ServiceCallbacksBuilder B add(InstanceCbServiceRef<S> add); /** - * Sets an <code>object instance callback(Service, ServiceReference)</code> callback. The callback is invoked when a service is changed. + * Sets an <code>Object instance callback(Service, ServiceReference)</code> method reference. The callback is invoked when a service is changed. * The method reference must point to method from an Object instance. * * @param change the method reference invoked when a service is changed. @@ -472,7 +491,7 @@ public interface ServiceCallbacksBuilder B change(InstanceCbServiceRef<S> change); /** - * Sets an <code>object instance callback(Service, ServiceReference)</code> callback. The callback is invoked when a service is removed. + * Sets an <code>Object instance callback(Service, ServiceReference)</code> method reference. The callback is invoked when a service is removed. * The method reference must point to method from an Object instance. * * @param remove the method reference invoked when a service is removed. @@ -481,7 +500,7 @@ public interface ServiceCallbacksBuilder B remove(InstanceCbServiceRef<S> remove); /** - * Sets an <code>object instance callback(Service, Component)</code> callback invoked. The callback is when a service is added. + * Sets an <code>Object instance callback(Service, Component)</code> method reference. The callback is when a service is added. * The method reference must point to a method from an Object instance. * * @param add the method reference invoked when a service is added. @@ -490,7 +509,7 @@ public interface ServiceCallbacksBuilder B add(InstanceCbServiceComponent<S> add); /** - * Sets an <code>object instance callback(Service, Component)</code> callback invoked. The callback is when a service is changed. + * Sets an <code>Object instance callback(Service, Component)</code> method reference. The callback is when a service is changed. * The method reference must point to method from an Object instance. * * @param change the method reference invoked when a service is changed. @@ -499,7 +518,7 @@ public interface ServiceCallbacksBuilder B change(InstanceCbServiceComponent<S> change); /** - * Sets an <code>object instance callback(Service, Component)</code> callback. The callback is invoked when a service is removed. + * Sets an <code>Object instance callback(Service, Component)</code> method reference. The callback is invoked when a service is removed. * The method reference must point to method from an Object instance. * * @param remove the method reference invoked when a service is removed. @@ -508,7 +527,7 @@ public interface ServiceCallbacksBuilder B remove(InstanceCbServiceComponent<S> remove); /** - * Sets an <code>object instance callback(Service, Component, ServiceReference)</code> callback. The callback is invoked when a service is added. + * Sets an <code>Object instance callback(Service, Component, ServiceReference)</code> method reference. The callback is invoked when a service is added. * The method reference must point to a method from an Object instance. * * @param add the method reference invoked when a service is added. @@ -517,7 +536,7 @@ public interface ServiceCallbacksBuilder B add(InstanceCbServiceComponentRef<S> add); /** - * Sets an <code>object instance callback(Service, Component, ServiceReference)</code> callback. The callback is invoked when a service is changed. + * Sets an <code>Object instance callback(Service, Component, ServiceReference)</code> method reference. The callback is invoked when a service is changed. * The method reference must point to method from an Object instance. * * @param change the method reference invoked when a service is changed. @@ -526,7 +545,7 @@ public interface ServiceCallbacksBuilder B change(InstanceCbServiceComponentRef<S> change); /** - * Sets an <code>object instance callback(Service, Component, ServiceReference)</code> callback. The callback is invoked when a service is removed. + * Sets an <code>Object instance callback(Service, Component, ServiceReference)</code> method reference. The callback is invoked when a service is removed. * The method reference must point to method from an Object instance. * * @param remove the method reference invoked when a service is removed. @@ -535,42 +554,42 @@ public interface ServiceCallbacksBuilder B remove(InstanceCbServiceComponentRef<S> remove); /** - * Sets a swap <code>component instance callback(Service, Service)</code> method reference. The callback is invoked when a service is swapped. + * Sets a swap <code>component callback(Service, Service)</code> method reference. The callback is invoked when a service is swapped. * The method reference must point to a Component implementation class method. * - * @param <T> the type of the component instance class on which the callback is invoked. + * @param <T> the type of the component implementation class on which the callback is invoked. * @param swap the method reference invoked when the service is swapped. * @return this builder */ <T> B swap(CbServiceService<T, S> swap); /** - * Sets a wap <code>component instance callback(Service, Service, Component)</code> method reference. The callback is invoked when a service is swapped. + * Sets a wap <code>component callback(Service, Service, Component)</code> method reference. The callback is invoked when a service is swapped. * The method reference must point to a Component implementation class method. * - * @param <T> the type of the component instance class on which the callback is invoked. + * @param <T> the type of the component implementation class on which the callback is invoked. * @param swap the method reference invoked when the service is swapped. * @return this builder */ <T> B swap(CbServiceServiceComponent<T, S> swap); /** - * Sets a swap <code>component instance callback(ServiceReference, Service, ServiceReference, Service)</code> method reference. The callback is invoked when a service is swapped. + * Sets a swap <code>component callback(ServiceReference, Service, ServiceReference, Service)</code> method reference. The callback is invoked when a service is swapped. * The method reference must point to a Component implementation class method. * the new service. * - * @param <T> the type of the component instance class on which the callback is invoked. + * @param <T> the type of the component implementation class on which the callback is invoked. * @param swap the method reference invoked when the service is swapped. * @return this builder */ <T> B swap(CbRefServiceRefService<T, S> swap); /** - * Sets a swap <code>component instance callback(ServiceReference, Service, ServiceReference, Service, Component</code> method reference. The callback is invoked when a service is swapped. + * Sets a swap <code>component callback(ServiceReference, Service, ServiceReference, Service, Component</code> method reference. The callback is invoked when a service is swapped. * The method reference must point to a Component implementation class method. * the new service. * - * @param <T> the type of the component instance class on which the callback is invoked. + * @param <T> the type of the component implementation class on which the callback is invoked. * @param swap the method reference invoked when the service is swapped. * @return this builder */ Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ServiceDependencyBuilder.java URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ServiceDependencyBuilder.java?rev=1731476&r1=1731475&r2=1731476&view=diff ============================================================================== --- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ServiceDependencyBuilder.java (original) +++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ServiceDependencyBuilder.java Sat Feb 20 21:44:59 2016 @@ -1,3 +1,21 @@ +/* + * 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.dm.lambda; import java.util.Dictionary; @@ -9,9 +27,22 @@ import org.osgi.framework.ServiceReferen /** * Builds a Dependency Manager Service Dependency. - * The Dependency is required by default, but you can - * control the default mode (required or optional) using the "org.apache.felix.dependencymanager.lambda.dependencymode" - * system property which can be set to either "required" or "optional" ("required" by default). + * <p> When a service dependency is not explicitly defined as "required" or "optional", then it is assumed to be required by default. + * + * <p> Sample code: + * + * <pre> {@code + * public class Activator extends DependencyManagerActivator { + * public void init(BundleContext ctx, DependencyManager dm) throws Exception { + * component(comp -> comp + * .impl(Pojo.class) + * .withSrv(ConfigurationAdmin.class, "(vendor=apache)") // required service with a filter, injected in class field + * .withSrv(Coordinator.class, LogService.class) // varargs of required dependencies injected on class fields + * .withSrv(HttpService.class, svc -> srv.add(Pojo::setHttpService)) // required dependency injected using a method ref + * .withSrv(ConnectorService.class, svc -> svc.optional()) // optional dependency, injected in class field with a NullObject if unavailable (before start() callback). + * .withSrv(Tracked.class, srv -> srv.optional().add(Pojo::addTracked)) // optional dependency, injected using method ref, after the start() callback + * } + * }}</pre> * * @param <S> the type of the service dependency */ @@ -31,24 +62,21 @@ public interface ServiceDependencyBuilde ServiceDependencyBuilder<S> ref(ServiceReference<S> ref); /** - * Configures this dependency as optional. By default, the dependency is required, but you can specify the default mode - * using the "org.apache.felix.dependencymanager.lambda.dependencymode" system property. + * Configures this dependency as optional. * @return this builder */ ServiceDependencyBuilder<S> optional(); /** - * Configures this dependency as required. By default, the dependency is required, but you can specify the default mode - * using the "org.apache.felix.dependencymanager.lambda.dependencymode" system property. + * Configures this dependency as required. * @return this builder */ ServiceDependencyBuilder<S> required(); /** - * Configures whether this dependency is required or not. By default, the dependency is required, but you can specify the default mode - * using the "org.apache.felix.dependencymanager.lambda.dependencymode" system property. + * Configures whether this dependency is required or not. * - * @param required true if the dependency is required, false if not. Unlike with the original DM API, service dependencies are required by default. + * @param required true if the dependency is required, false if not. * @return this builder */ ServiceDependencyBuilder<S> required(boolean required); @@ -132,4 +160,4 @@ public interface ServiceDependencyBuilde * @return this builder */ ServiceDependencyBuilder<S> autoConfig(String field); -} \ No newline at end of file +} Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/Cb.java URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/Cb.java?rev=1731476&r1=1731475&r2=1731476&view=diff ============================================================================== --- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/Cb.java (original) +++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/Cb.java Sat Feb 20 21:44:59 2016 @@ -1,3 +1,21 @@ +/* + * 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.dm.lambda.callbacks; import java.util.Objects; @@ -22,4 +40,4 @@ public interface Cb<T> extends Serializa after.accept(t); }; } -} \ No newline at end of file +} Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbBundle.java URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbBundle.java?rev=1731476&r1=1731475&r2=1731476&view=diff ============================================================================== --- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbBundle.java (original) +++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbBundle.java Sat Feb 20 21:44:59 2016 @@ -1,3 +1,21 @@ +/* + * 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.dm.lambda.callbacks; import java.util.Objects; Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbBundleComponent.java URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbBundleComponent.java?rev=1731476&r1=1731475&r2=1731476&view=diff ============================================================================== --- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbBundleComponent.java (original) +++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbBundleComponent.java Sat Feb 20 21:44:59 2016 @@ -1,3 +1,21 @@ +/* + * 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.dm.lambda.callbacks; import java.util.Objects; Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbComponent.java URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbComponent.java?rev=1731476&r1=1731475&r2=1731476&view=diff ============================================================================== --- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbComponent.java (original) +++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbComponent.java Sat Feb 20 21:44:59 2016 @@ -1,3 +1,21 @@ +/* + * 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.dm.lambda.callbacks; import java.util.Objects; Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbConfiguration.java URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbConfiguration.java?rev=1731476&r1=1731475&r2=1731476&view=diff ============================================================================== --- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbConfiguration.java (original) +++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbConfiguration.java Sat Feb 20 21:44:59 2016 @@ -1,3 +1,21 @@ +/* + * 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.dm.lambda.callbacks; import java.util.Dictionary; Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbConfigurationComponent.java URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbConfigurationComponent.java?rev=1731476&r1=1731475&r2=1731476&view=diff ============================================================================== --- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbConfigurationComponent.java (original) +++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbConfigurationComponent.java Sat Feb 20 21:44:59 2016 @@ -1,3 +1,21 @@ +/* + * 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.dm.lambda.callbacks; import java.util.Dictionary; Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbDictionary.java URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbDictionary.java?rev=1731476&r1=1731475&r2=1731476&view=diff ============================================================================== --- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbDictionary.java (original) +++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbDictionary.java Sat Feb 20 21:44:59 2016 @@ -1,3 +1,21 @@ +/* + * 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.dm.lambda.callbacks; import java.util.Dictionary; Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbDictionaryComponent.java URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbDictionaryComponent.java?rev=1731476&r1=1731475&r2=1731476&view=diff ============================================================================== --- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbDictionaryComponent.java (original) +++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbDictionaryComponent.java Sat Feb 20 21:44:59 2016 @@ -1,3 +1,21 @@ +/* + * 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.dm.lambda.callbacks; import java.util.Dictionary; Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbFuture.java URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbFuture.java?rev=1731476&r1=1731475&r2=1731476&view=diff ============================================================================== --- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbFuture.java (original) +++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbFuture.java Sat Feb 20 21:44:59 2016 @@ -1,3 +1,21 @@ +/* + * 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.dm.lambda.callbacks; import java.util.Objects; Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbRefServiceRefService.java URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbRefServiceRefService.java?rev=1731476&r1=1731475&r2=1731476&view=diff ============================================================================== --- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbRefServiceRefService.java (original) +++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbRefServiceRefService.java Sat Feb 20 21:44:59 2016 @@ -1,3 +1,21 @@ +/* + * 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.dm.lambda.callbacks; import java.util.Objects; Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbRefServiceRefServiceComponent.java URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbRefServiceRefServiceComponent.java?rev=1731476&r1=1731475&r2=1731476&view=diff ============================================================================== --- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbRefServiceRefServiceComponent.java (original) +++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbRefServiceRefServiceComponent.java Sat Feb 20 21:44:59 2016 @@ -1,3 +1,21 @@ +/* + * 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.dm.lambda.callbacks; import java.util.Objects;
