8139e1de52285dc76df7cb2daae020ed9e89ebdd
[controller.git] / opendaylight / blueprint / src / main / java / org / opendaylight / controller / blueprint / ext / MandatoryServiceReferenceMetadata.java
1 /*
2  * Copyright (c) 2016 Brocade Communications Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.blueprint.ext;
9
10 import com.google.common.base.Preconditions;
11 import java.util.Collection;
12 import java.util.Collections;
13 import java.util.List;
14 import org.osgi.service.blueprint.reflect.ReferenceListener;
15 import org.osgi.service.blueprint.reflect.ServiceReferenceMetadata;
16
17 /**
18  * A ServiceReferenceMetadata implementation for a mandatory OSGi service.
19  *
20  * @author Thomas Pantelis
21  */
22 class MandatoryServiceReferenceMetadata implements ServiceReferenceMetadata {
23     private final String interfaceClass;
24     private final String id;
25
26     MandatoryServiceReferenceMetadata(final String id, final String interfaceClass) {
27         this.id = Preconditions.checkNotNull(id);
28         this.interfaceClass = interfaceClass;
29     }
30
31     @Override
32     public String getId() {
33         return id;
34     }
35
36     @Override
37     public int getActivation() {
38         return ACTIVATION_EAGER;
39     }
40
41     @Override
42     public List<String> getDependsOn() {
43         return Collections.emptyList();
44     }
45
46     @Override
47     public int getAvailability() {
48         return AVAILABILITY_MANDATORY;
49     }
50
51     @Override
52     public String getInterface() {
53         return interfaceClass;
54     }
55
56     @Override
57     public String getComponentName() {
58         return null;
59     }
60
61     @Override
62     public String getFilter() {
63         return ComponentProcessor.DEFAULT_TYPE_FILTER;
64     }
65
66     @Override
67     public Collection<ReferenceListener> getReferenceListeners() {
68         return Collections.emptyList();
69     }
70 }