/* 
 * 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.util;

import org.osgi.framework.ServiceReference;

/**
 * Tracker Customizer.
 * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
 */
public interface TrackerCustomizer {

    /**
     * A service is being added to the Tracker object.
     * This method is called before a service which matched the search parameters of the Tracker object is added to it. This method should return the service object to be tracked for this ServiceReference object.
     * The returned service object is stored in the Tracker object and is available from the getService and getServices methods.
     * @param reference the Reference to service being added to the Tracker object.
     * @return The service object to be tracked for the ServiceReference object or null if the ServiceReference object should not be tracked.
     */
    boolean addingService(ServiceReference reference);
    
    /**
     * A service tracked by the Tracker object has been added in the list.
     * This method is called when a service has been added in the managed list (after addingService) and if the service has not disappeared before during the callback.
     * @param reference the added reference.
     */
    void addedService(ServiceReference reference);

    /**
     * A service tracked by the Tracker object has been modified.
     * This method is called when a service being tracked by the Tracker object has had it properties modified.
     * @param reference the Reference to service that has been modified.
     * @param service The service object for the modified service.
     */
    void modifiedService(ServiceReference reference, Object service);

    /**
     * A service tracked by the Tracker object has been removed.
     * This method is called after a service is no longer being tracked by the Tracker object.
     * @param reference the Reference to service that has been removed.
     * @param service The service object for the removed service.
     */
    void removedService(ServiceReference reference, Object service);

}

@@ -1234,16 +1234,24 @@
 added to
+%0D%0A     *
  it. Thi
@@ -1352,68 +1352,64 @@
   * 
-The returned service object is stored in the Tracker
+If this method returns %7B@code true%7D, the service
  object 
 and 
@@ -1404,21 +1404,22 @@
  object 
-and i
+become
 s availa
@@ -1431,16 +1431,31 @@
 rom the 
+%7B@link Tracker#
 getServi
@@ -1456,21 +1456,47 @@
 tService
+()%7D
  and
- 
+%0D%0A     * %7B@link Tracker#
 getServi
@@ -1498,16 +1498,19 @@
 Services
+()%7D
  methods
@@ -1510,16 +1510,86 @@
 methods.
+ However notice that the service is still not accessible at that time.
 %0D%0A     *
@@ -1686,57 +1686,37 @@
 urn 
-The service object to be tracked for
+%7B@code true%7D if
  the 
-S
+s
 ervice
-R
+ r
 efer
@@ -1724,38 +1724,55 @@
 nce 
-object or null i
+must be tracked. %7B@code false%7D f
 f the 
-S
+s
 ervice
-R
+ r
 efer
@@ -1780,37 +1780,44 @@
 nce 
-object should not be 
+must be%0D%0A     * ignored (un-
 tracked
-.
+)
 %0D%0A  
@@ -2077,24 +2077,32 @@
 ) and if the
+%0D%0A     *
  service has
@@ -2147,16 +2147,161 @@
 lback.%0D%0A
+     * In this method, the service object is accessible from the %7B@link Tracker#getService()%7D and%0D%0A     * %7B@link Tracker#getServices()%7D method.%0D%0A
      * @
@@ -2521,22 +2521,16 @@
 service 
-being 
 tracked 
@@ -2548,25 +2548,15 @@
 ker 
-object has had
+has
  it
+s
  pro
@@ -2594,33 +2594,33 @@
 m reference the 
-R
+r
 eference to serv
@@ -2902,23 +2902,30 @@
  called 
-after a
+when a tracked
  service
@@ -2968,32 +2968,210 @@
 racker object.%0D%0A
+     * Notice that some OSGi implementations does not support getting the service object from the bundle context in%0D%0A     * this method. The cached (given) object must be used.%0D%0A
      * @param re
@@ -3174,33 +3174,33 @@
 m reference the 
-R
+r
 eference to serv

Fix FELIX-4183