Framework Professional Edition Package


com.prosyst.util.breq
Class BundleRequirementsUtils

java.lang.Object
  extended by com.prosyst.util.breq.BundleRequirementsUtils

public class BundleRequirementsUtils
extends java.lang.Object

Here are provided utility methods for parsing bundle requirements data.


Field Summary
static java.lang.String HEADER_NAME
          Constant for Bundle-Requirements header.
static java.lang.String PERMISSIONS
          Constant for bundle permission requirement type.
static java.lang.String PLATFORMS
          Constant for bundle platforms requirement type.
static java.lang.String REQUIREMENT
          Constant for requirement parameter.
static java.lang.String RESOURCES
          Constant for bundle resource requirement type.
 
Constructor Summary
BundleRequirementsUtils()
           
 
Method Summary
static java.io.InputStream getBundleRequirements(Bundle bundle, java.lang.String requirementType)
          Gets bundle requirements, pointed by header Bundle-Requirements.
static java.lang.String getLocation(java.lang.String bundleRequirement, java.lang.String requirementType)
          Gets the location of the xml file, which holds some bundle requirements data.
static java.lang.String readNextOpenTag(java.io.InputStream is)
          Reads the name of the next open tag.
static java.lang.String readTagContents(java.io.InputStream is)
          Reads contents up to '<' symbol.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCES

public static final java.lang.String RESOURCES
Constant for bundle resource requirement type. See getBundleRequirements().

See Also:
Constant Field Values

PERMISSIONS

public static final java.lang.String PERMISSIONS
Constant for bundle permission requirement type. See getBundleRequirements().

See Also:
Constant Field Values

PLATFORMS

public static final java.lang.String PLATFORMS
Constant for bundle platforms requirement type. See getBundleRequirements().

See Also:
Constant Field Values

HEADER_NAME

public static final java.lang.String HEADER_NAME
Constant for Bundle-Requirements header.

See Also:
Constant Field Values

REQUIREMENT

public static final java.lang.String REQUIREMENT
Constant for requirement parameter.

See Also:
Constant Field Values
Constructor Detail

BundleRequirementsUtils

public BundleRequirementsUtils()
Method Detail

getBundleRequirements

public static java.io.InputStream getBundleRequirements(Bundle bundle,
                                                        java.lang.String requirementType)
                                                 throws java.io.IOException,
                                                        java.lang.IllegalArgumentException
Gets bundle requirements, pointed by header Bundle-Requirements.

Parameters:
bundle - target bundle, whose requirements are of interest.
requirementType - type of requirement; possible values are: resources, permissions and platforms;
Returns:
bundle requirement data or null if not pointed
Throws:
java.io.IOException - If an I/O error occurs while trying to get stream from the given location
java.lang.IllegalArgumentException - if Bundle-Requirement header is incorrect

getLocation

public static java.lang.String getLocation(java.lang.String bundleRequirement,
                                           java.lang.String requirementType)
                                    throws java.lang.IllegalArgumentException
Gets the location of the xml file, which holds some bundle requirements data.

Parameters:
bundleRequirement - Must have syntax of a Bundle-Requirements header: "Bundle-Requirements" := 1*(,*(;requirement=)) Example: Bundle-Requirements : "/bundle-requirements.xml"; requirement="permissions"; requirement="resources", "/platforms.xml";requirement="platforms"
requirementType - Type of requirement - can be permissions, platforms, or resources
Returns:
The locaiton of the xml file.
Throws:
java.lang.IllegalArgumentException - If header has incorrect syntax

readNextOpenTag

public static java.lang.String readNextOpenTag(java.io.InputStream is)
                                        throws java.io.IOException,
                                               java.lang.IllegalArgumentException
Reads the name of the next open tag. Skips data starting with "' or '/>'- in case of empty tags.

Parameters:
is - to read tag from
Returns:
tag name
Throws:
java.io.IOException - if an I/O error occurs while reading
java.lang.IllegalArgumentException - if EOF is encountered before being able to read the tag

readTagContents

public static java.lang.String readTagContents(java.io.InputStream is)
                                        throws java.io.IOException,
                                               java.lang.IllegalArgumentException
Reads contents up to '<' symbol. The method may be called after readNextOpenTag, so that the pointer is positioned at tag contents.

Parameters:
is - to read contents from
Returns:
tag contents
Throws:
java.io.IOException - if an I/O error occurs while reading
java.lang.IllegalArgumentException - if EOF is reached before reading the whole contents

Framework Professional Edition Package


Copyright © 1999-2007 ProSyst Software GmbH. All Rights Reserved