| 1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2008, 2017 EclipseSource and others. |
| 3 |
* |
| 4 |
* This |
| 5 |
* program and the accompanying materials are made available under the terms of |
| 6 |
* the Eclipse Public License 2.0 which accompanies this distribution, and is |
| 7 |
* available at |
| 8 |
* https://www.eclipse.org/legal/epl-2.0/ |
| 9 |
* |
| 10 |
* SPDX-License-Identifier: EPL-2.0 |
| 11 |
* |
| 12 |
* Contributors: |
| 13 |
* EclipseSource - initial API and implementation |
| 14 |
* IBM - ongoing development |
| 15 |
******************************************************************************/ |
| 16 |
package org.eclipse.equinox.p2.metadata; |
| 17 |
|
| 18 |
import java.net.URI; |
| 19 |
|
| 20 |
/** |
| 21 |
* The <code>ILicense</code> interface represents a software license. A license has required body text |
| 22 |
* which may be the full text or an annotation. An optional URL field can be specified |
| 23 |
* which links to full text. Licenses can be easily compared using their digests. |
| 24 |
* Licenses can be added to arbitrary installable units, and will typically be displayed to |
| 25 |
* end users and require explicit agreement before installation proceeds. |
| 26 |
* <p> |
| 27 |
* Instances of this class are handle objects and do not necessarily |
| 28 |
* reflect entities that exist in any particular profile or repository. These handle |
| 29 |
* objects can be created using {@link MetadataFactory}. |
| 30 |
* </p> |
| 31 |
* |
| 32 |
* @noimplement This interface is not intended to be implemented by clients. |
| 33 |
* @noextend This interface is not intended to be extended by clients. |
| 34 |
* @since 2.0 |
| 35 |
*/ |
| 36 |
public interface ILicense { |
| 37 |
|
| 38 |
/** |
| 39 |
* Returns the location of a document containing the full license. |
| 40 |
* |
| 41 |
* @return the location of the license document, or <code>null</code> |
| 42 |
*/ |
| 43 |
public URI getLocation(); |
| 44 |
|
| 45 |
/** |
| 46 |
* Returns the license body. |
| 47 |
* @return the license body, never <code>null</code> |
| 48 |
*/ |
| 49 |
public String getBody(); |
| 50 |
|
| 51 |
/** |
| 52 |
* Returns the message digest of the license body. The digest is calculated on a normalized |
| 53 |
* version of the license where all whitespace has been reduced to one space. |
| 54 |
* |
| 55 |
* @return the message digest as a <code>BigInteger</code>, never <code>null</code> |
| 56 |
*/ |
| 57 |
public String getUUID(); |
| 58 |
|
| 59 |
/** |
| 60 |
* Returns whether this license is equal to the given object. |
| 61 |
* |
| 62 |
* This method returns <i>true</i> if: |
| 63 |
* <ul> |
| 64 |
* <li> Both this object and the given object are of type ILicense |
| 65 |
* <li> The result of <b>getDigest()</b> on both objects are equal |
| 66 |
* </ul> |
| 67 |
*/ |
| 68 |
@Override |
| 69 |
public boolean equals(Object obj); |
| 70 |
|
| 71 |
} |