001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *   http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019
020package org.apache.felix.ipojo.dependency.impl;
021
022import org.apache.felix.ipojo.dependency.interceptors.ServiceRankingInterceptor;
023import org.apache.felix.ipojo.util.DependencyModel;
024import org.osgi.framework.ServiceReference;
025
026import java.util.ArrayList;
027import java.util.Collections;
028import java.util.Comparator;
029import java.util.List;
030
031/**
032 * An empty version of the ranking interceptor.
033 */
034public class EmptyBasedServiceRankingInterceptor implements ServiceRankingInterceptor {
035
036    public void open(DependencyModel dependency) { }
037
038    public List<ServiceReference> getServiceReferences(DependencyModel dependency, List<ServiceReference> matching) {
039        return matching;
040    }
041
042    public List<ServiceReference> onServiceArrival(DependencyModel dependency, List<ServiceReference> matching, ServiceReference<?> reference) {
043        return getServiceReferences(dependency, matching);
044    }
045
046    public List<ServiceReference> onServiceDeparture(DependencyModel dependency, List<ServiceReference> matching,
047                                                     ServiceReference<?> reference) {
048        return getServiceReferences(dependency, matching);
049    }
050
051    public List<ServiceReference> onServiceModified(DependencyModel dependency, List<ServiceReference> matching, ServiceReference<?> reference) {
052        return getServiceReferences(dependency, matching);
053    }
054
055    public void close(DependencyModel dependency) {  }
056}