Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.osgi.util
Class ManifestElement  view ManifestElement download ManifestElement.java

java.lang.Object
  extended byorg.eclipse.osgi.util.ManifestElement

public class ManifestElement
extends java.lang.Object

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 ';'. A manifeset element may optionally have a set of attribute values associated with it. The general syntax of a manifest element is the following

 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.


Field Summary
protected  java.util.Hashtable attributes
          The table of attributes for the manifest element.
protected  java.lang.String value
          The value of the manifest element.
protected  java.lang.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(java.lang.String key, java.lang.String value)
          Adds an attribute to this manifest element.
 java.lang.String getAttribute(java.lang.String key)
          Returns the value for the specified attribute.
 java.lang.String[] getAttributes(java.lang.String key)
          Returns an array of values for the specified attribute.
 java.util.Enumeration getKeys()
          Returns the Enumeration of attribute keys for this manifest element.
 java.lang.String getValue()
          Returns the value of the manifest element.
 java.lang.String[] getValueComponents()
          Returns the value components of the manifest element.
static ManifestElement[] parseHeader(java.lang.String header, java.lang.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

value

protected java.lang.String value
The value of the manifest element.


valueComponents

protected java.lang.String[] valueComponents
The value components of the manifest element.


attributes

protected java.util.Hashtable attributes
The table of attributes for the manifest element.

Constructor Detail

ManifestElement

protected ManifestElement()
Constructs an empty manifest element with no value or attributes.

Method Detail

getValue

public java.lang.String getValue()
Returns the value of the manifest element. The value returned is the complete value up to the first attribute. For example, the following manifest element:

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"


getValueComponents

public java.lang.String[] getValueComponents()
Returns the value components of the manifest element. The value components returned are the complete list of value components up to the first attribute. For example, the folowing manifest element:

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 ';'.


getAttribute

public java.lang.String getAttribute(java.lang.String key)
Returns the value for the specified attribute. 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.


getAttributes

public java.lang.String[] getAttributes(java.lang.String key)
Returns an array of values for the specified attribute.


getKeys

public java.util.Enumeration getKeys()
Returns the Enumeration of attribute keys for this manifest element.


addAttribute

protected void addAttribute(java.lang.String key,
                            java.lang.String value)
Adds an attribute to this manifest element.


parseHeader

public static ManifestElement[] parseHeader(java.lang.String header,
                                            java.lang.String value)
                                     throws org.osgi.framework.BundleException
Parses a manifest header value into an array of ManifestElements. Each ManifestElement returned will have a non-null value returned by getValue().