1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.project.management;
14 import org.eclipse.equinox.p2.metadata.IInstallableUnit;
15 import org.eclipse.equinox.p2.metadata.IVersionedId;
16 import org.eclipse.equinox.p2.metadata.Version;
17 import org.eclipse.equinox.p2.metadata.VersionedId;
19 public class BundleInfo implements Comparable<BundleInfo>, IVersionedId {
21 public static BundleInfo read(IInstallableUnit iu) {
22 String name = iu.getProperty("org.eclipse.equinox.p2.name");
23 String description = iu.getProperty("org.eclipse.equinox.p2.description");
24 return new BundleInfo(iu, name, description);
27 public IVersionedId vid;
29 public String description;
31 public BundleInfo(String id, String version, String name, String description) {
32 vid = new VersionedId(id, version);
34 this.description = description;
37 public BundleInfo(IVersionedId vid, String name, String description) {
40 this.description = description;
44 public String toString() {
48 public String toVersionString() {
49 return Version.emptyVersion.equals(vid.getVersion()) ? vid.getId() : vid.getId() + '/' + vid.getVersion().toString();
53 public int compareTo(BundleInfo o) {
54 return name.compareTo( o.name );
57 public String getId() {
61 public void setId(IVersionedId vid) {
65 public Version getVersion() {
66 return vid.getVersion();
69 public String getDescription() {
73 public void setDescription(String description) {
74 this.description = description;
77 public String getName() {
81 public void setName(String name) {
86 public int hashCode() {
87 return vid.hashCode();
91 public boolean equals(Object obj) {
92 return vid.equals(obj);