Debian Codegraph @

src/org/osgi/resource/Resource.java

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
•1 /*
2 * Copyright (c) OSGi Alliance (2011, 2013). All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package org.osgi.resource;
18
19 import java.util.List;
20 import org.osgi.annotation.versioning.ConsumerType;
21
22 /**
23 * A resource is the representation of a uniquely identified and typed data. A
24 * resource declares requirements that need to be satisfied by capabilities
25 * before it can provide its capabilities.
26 *
27 * <p>
28 * Instances of this type must be <i>effectively immutable</i>. That is, for a
29 * given instance of this interface, the methods defined by this interface must
30 * always return the same result.
31 *
32 * @ThreadSafe
33 * @author $Id: c7b6462fb53b38ac3071d7ba73af9dad2af6b9ce $
34 */
35 @ConsumerType
36 public interface Resource {
37 /**
38 * Returns the capabilities declared by this resource.
39 *
40 * @param namespace The namespace of the declared capabilities to return or
41 * {@code null} to return the declared capabilities from all
42 * namespaces.
43 * @return An unmodifiable list containing the declared {@link Capability}s
44 * from the specified namespace. The returned list will be empty if
45 * this resource declares no capabilities in the specified
46 * namespace.
47 */
48 List<Capability> getCapabilities(String namespace);
49
50 /**
51 * Returns the requirements declared by this bundle resource.
52 *
53 * @param namespace The namespace of the declared requirements to return or
54 * {@code null} to return the declared requirements from all
55 * namespaces.
56 * @return An unmodifiable list containing the declared {@link Requirement}
57 * s from the specified namespace. The returned list will be empty
58 * if this resource declares no requirements in the specified
59 * namespace.
60 */
61 List<Requirement> getRequirements(String namespace);
62
63 /**
64 * Compares this {@code Resource} to another {@code Resource}.
65 *
66 * <p>
67 * This {@code Resource} is equal to another {@code Resource} if both have
68 * the same content and come from the same location. Location may be defined
69 * as the bundle location if the resource is an installed bundle or the
70 * repository location if the resource is in a repository.
71 *
72 * @param obj The object to compare against this {@code Resource}.
73 * @return {@code true} if this {@code Resource} is equal to the other
74 * object; {@code false} otherwise.
75 */
76 boolean equals(Object obj);
77
78 /**
79 * Returns the hashCode of this {@code Resource}.
80 *
81 * @return The hashCode of this {@code Resource}.
82 */
83 int hashCode();
84 }