|
Eclipse Platform Release 3.1 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.osgi.util.ManifestElement
This class represents a single manifest element. A manifest element must consist of a single
String
value. The String
value may be split up into component values each
separated by a semi-colon (';'). A manifest element may optionally have a set of
attribute values associated with it. The general syntax of a manifest element is as follows:
ManifestElement ::= headervalues (';' attribute)* headervalues ::= headervalue (';' headervalue)* headervalue ::=attribute ::= key '=' value key ::= token value ::= token | quoted-string
For example, The following is an example of a manifest element to the Export-Package header:
org.osgi.framework; specification-version="1.2"; another-attr="examplevalue"
This manifest element has a value of org.osgi.framework and it has two attributes, specification-version and another-attr.
The following manifest element is an example of a manifest element that has multiple components to its value:
code1.jar;code2.jar;code3.jar;attr1=value1;attr2=value2;attr3=value3
This manifest element has a value of code1.jar;code2.jar;code3.jar. This is an example of a multiple component value. This value has three components: code1.jar, code2.jar, and code3.jar.
This class is not intended to be subclassed by clients.
Field Summary | |
---|---|
protected Hashtable |
attributes
The table of attributes for the manifest element. |
protected Hashtable |
directives
The table of directives for the manifest element. |
protected String |
value
The value of the manifest element. |
protected String[] |
valueComponents
The value components of the manifest element. |
Constructor Summary | |
---|---|
protected |
ManifestElement()
Constructs an empty manifest element with no value or attributes. |
Method Summary | |
---|---|
protected void |
addAttribute(String key,
String value)
Add an attribute to this manifest element. |
protected void |
addDirective(String key,
String value)
Add a directive to this manifest element. |
static String[] |
getArrayFromList(String stringList)
Returns the result of converting a list of comma-separated tokens into an array. |
String |
getAttribute(String key)
Returns the value for the specified attribute or null if it does
not exist. |
String[] |
getAttributes(String key)
Returns an array of values for the specified attribute or null if the attribute does not exist. |
String |
getDirective(String key)
Returns the value for the specified directive or null if it
does not exist. |
Enumeration |
getDirectiveKeys()
Return an enumeration of directive keys for this manifest element or null if there are none. |
String[] |
getDirectives(String key)
Returns an array of string values for the specified directives or null if it does not exist. |
Enumeration |
getKeys()
Returns an enumeration of attribute keys for this manifest element or null if none exist. |
String |
getValue()
Returns the value of the manifest element. |
String[] |
getValueComponents()
Returns the value components of the manifest element. |
static ManifestElement[] |
parseHeader(String header,
String value)
Parses a manifest header value into an array of ManifestElements. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected String value
protected String[] valueComponents
protected Hashtable attributes
protected Hashtable directives
Constructor Detail |
protected ManifestElement()
Method Detail |
public String getValue()
test1.jar;test2.jar;test3.jar;selection-filter="(os.name=Windows XP)"
This manifest element has a value of test1.jar;test2.jar;test3.jar
public String[] getValueComponents()
test1.jar;test2.jar;test3.jar;selection-filter="(os.name=Windows XP)"
This manifest element has the value components array { "test1.jar", "test2.jar", "test3.jar" } Each value component is delemited by a semi-colon (';').
public String getAttribute(String key)
null
if it does
not exist. If the attribute has multiple values specified then the last value
specified is returned. For example the following manifest element:
elementvalue; myattr="value1"; myattr="value2"
specifies two values for the attribute key myattr. In this case value2 will be returned because it is the last value specified for the attribute myattr.
key
- the attribute key to return the value for
null
public String[] getAttributes(String key)
null
if the attribute does not exist.
key
- the attribute key to return the values for
null
getAttribute(String)
public Enumeration getKeys()
null
if none exist.
protected void addAttribute(String key, String value)
key
- the key of the attributevalue
- the value of the attributepublic String getDirective(String key)
null
if it
does not exist. If the directive has multiple values specified then the
last value specified is returned. For example the following manifest element:
elementvalue; mydir:="value1"; mydir:="value2"
specifies two values for the directive key mydir. In this case value2 will be returned because it is the last value specified for the directive mydir.
key
- the directive key to return the value for
null
public String[] getDirectives(String key)
null
if it does not exist.
key
- the directive key to return the values for
null
getDirective(String)
public Enumeration getDirectiveKeys()
null
if there are none.
null
protected void addDirective(String key, String value)
key
- the key of the attributevalue
- the value of the attributepublic static ManifestElement[] parseHeader(String header, String value) throws BundleException
header
- the header name to parse. This is only specified to provide error messages
when the header value is invalid.value
- the header value to parse.
BundleException
- if the header value is invalidpublic static String[] getArrayFromList(String stringList)
stringList
- the initial comma-separated string
null
if there are none
|
Eclipse Platform Release 3.1 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2005. All rights reserved.