|
Added
Link Here
|
| 1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2010 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
| 6 |
* http://www.eclipse.org/legal/epl-v10.html |
| 7 |
* |
| 8 |
* Contributors: |
| 9 |
* IBM Corporation - initial API and implementation |
| 10 |
*******************************************************************************/ |
| 11 |
package org.eclipse.pde.internal.core.importing.provisional; |
| 12 |
|
| 13 |
import java.util.HashMap; |
| 14 |
import java.util.Map; |
| 15 |
|
| 16 |
/** |
| 17 |
* Describes how a bundle import will be executed. A bundle importer delegate |
| 18 |
* creates bundle import descriptions when it validates bundle manifests for |
| 19 |
* importing. When asked to import bundles, it is passed back the instances |
| 20 |
* of bundle import descriptions is created. However, the target project |
| 21 |
* may have been modified and properties may have been modified. |
| 22 |
* <p> |
| 23 |
* Clients may instantiate this class. Clients may subclass this class to |
| 24 |
* implement model specific behavior and include model specific data in import |
| 25 |
* descriptions. |
| 26 |
* </p> |
| 27 |
* <p> |
| 28 |
* <strong>EXPERIMENTAL</strong>. This class has been added as |
| 29 |
* part of a work in progress. There is no guarantee that this API will |
| 30 |
* work or that it will remain the same. Please do not use this API without |
| 31 |
* consulting with the PDE team. |
| 32 |
* </p> |
| 33 |
* @since 3.6 |
| 34 |
*/ |
| 35 |
public class BundleImportDescription { |
| 36 |
|
| 37 |
private String project; |
| 38 |
private Map manifest; |
| 39 |
private Map properties; |
| 40 |
|
| 41 |
/** |
| 42 |
* Constructs a bundle import description with given project and manifest. |
| 43 |
* |
| 44 |
* @param project the project the bundle should be imported into which may |
| 45 |
* or may not exist |
| 46 |
* @param manifest bundle manifest headers and values |
| 47 |
*/ |
| 48 |
public BundleImportDescription(String project, Map manifest) { |
| 49 |
this.project = project; |
| 50 |
this.manifest = manifest; |
| 51 |
} |
| 52 |
|
| 53 |
/** |
| 54 |
* Sets or removes a client property. |
| 55 |
* |
| 56 |
* @param key property key |
| 57 |
* @param value property value or <code>null</code> to remove the property |
| 58 |
*/ |
| 59 |
public synchronized void setProperty(String key, Object value) { |
| 60 |
if (properties == null) { |
| 61 |
properties = new HashMap(); |
| 62 |
} |
| 63 |
if (value == null) { |
| 64 |
properties.remove(key); |
| 65 |
} else { |
| 66 |
properties.put(key, value); |
| 67 |
} |
| 68 |
|
| 69 |
} |
| 70 |
|
| 71 |
/** |
| 72 |
* Returns the specified client property, or <code>null</code> if none. |
| 73 |
* |
| 74 |
* @param key property key |
| 75 |
* @return property value or <code>null</code> |
| 76 |
*/ |
| 77 |
public synchronized Object getProperty(String key) { |
| 78 |
if (properties == null) { |
| 79 |
return null; |
| 80 |
} |
| 81 |
return properties.get(key); |
| 82 |
} |
| 83 |
|
| 84 |
/** |
| 85 |
* Returns the project name the bundle will be imported into. The project |
| 86 |
* may or may not exist before the import. However, when the import operation |
| 87 |
* beings, the project will not exist. |
| 88 |
* |
| 89 |
* @return target project |
| 90 |
*/ |
| 91 |
public synchronized String getProject() { |
| 92 |
return project; |
| 93 |
} |
| 94 |
|
| 95 |
/** |
| 96 |
* Returns the manifest of the bundle to be imported. |
| 97 |
* |
| 98 |
* @return bundle manifest keys and values |
| 99 |
*/ |
| 100 |
public Map getManifest() { |
| 101 |
return manifest; |
| 102 |
} |
| 103 |
|
| 104 |
/** |
| 105 |
* Sets the project name that is the target of the import operation. |
| 106 |
* |
| 107 |
* @param project target project |
| 108 |
*/ |
| 109 |
public synchronized void setProject(String project) { |
| 110 |
this.project = project; |
| 111 |
} |
| 112 |
|
| 113 |
} |