com.ibm.cics.bundle
Class Bundle

java.lang.Object
  extended by com.ibm.cics.bundle.Bundle

public class Bundle
extends java.lang.Object

Usage:
This class is used to generate Bundle archives.

Class level design/service information:
This class provides the functionality for the user to create new bundle archives together with associated manifest file (including support for IMPORT, EXPORT and DEFINEs.

Version:
%E%
Author:
Pradeep Gohil
See Also:
Bundle

Field Summary
static int MANIFEST_DEFINE
          Constant to represent MANIFEST_DEFINE element.
static int MANIFEST_EXPORT
          Constant to represent MANIFEST_EXPORT element.
static int MANIFEST_IMPORT
          Constant to represent MANIFEST_IMPORT element.
 
Constructor Summary
Bundle(java.util.jar.JarOutputStream jarOutputStream)
          Usage:
Contructor to create new Bundle and initialize default Manifest file values.
 
Method Summary
 void addArchiveFile(java.lang.String path, java.io.InputStream inputStream)
          Usage:
Function to read in a stream and write it to the bundle archive file.
 void addDefine(Manifest.Define defElement, java.io.InputStream inputStream)
           
 void addDefine(java.lang.String name, java.lang.String type, java.lang.String path, java.io.InputStream inputStream)
          Usage:
To add a DEFINE element and stream to the bundle and manifest.
(1)The manifest entry is written first and then (2)the stream is added to the bundle archive.
 void addDefine(java.lang.String name, java.lang.String type, java.lang.String path, java.io.InputStream inputStream, boolean optional, boolean warn)
          Usage:
To add a DEFINE element and stream to the bundle and manifest.
(1)The manifest entry is written first and then (2)the stream is added to the bundle archive.
 void addExport(Manifest.Export expElement)
           
 void addExport(java.lang.String name, java.lang.String type)
          Usage:
To add an EXPORT element to the bundle and manifest.
Any existing EXPORT with the same name and type is overwritten.
 void addImport(Manifest.Import impElement)
           
 void addImport(java.lang.String name, java.lang.String type)
          Usage:
To add an IMPORT element to the bundle and manifest.
Any existing IMPORT with the same name and type is overwritten.
 void addImport(java.lang.String name, java.lang.String type, boolean optional, boolean warn)
          Usage:
To add an IMPORT element to the bundle and manifest.
Any existing IMPORT with the same name and type is overwritten.
 void deleteDefine(java.lang.String name, java.lang.String type)
          Usage:
To delete a DEFINE element from the Manifest instance.
Note: Any files/streams written to the bundle archive will persist.
Existing DEFINE element with the supplied name and type is deleted from the Manifest.
 void deleteExport(java.lang.String name, java.lang.String type)
          Usage:
To delete an EXPORT element from the bundle instance.
Existing EXPORT with the supplied name and type is deleted.
 void deleteImport(java.lang.String name, java.lang.String type)
          Usage:
To delete an IMPORT element from the bundle instance.
Existing IMPORT with the supplied name and type is deleted.
 boolean manifestEntryExist(int elementType, java.lang.String name, java.lang.String type)
          Usage:
To check if the Manifest instance contains an existence of the named element
 void writeArchive()
          Usage:
This function should be called after all entries (DEFINEs, IMPORTs and EXPORTs) have been added to the Bundle archive.
The Manifest XML file is created and added to the Bundle archive.
 void writeManifest(java.io.OutputStream manifestOutStream)
          Usage:
This function should be called after all entries (DEFINEs, IMPORTs and EXPORTs) have been added to the Manifest.
Only returns the Manifest file
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MANIFEST_IMPORT

public static final int MANIFEST_IMPORT
Constant to represent MANIFEST_IMPORT element.

See Also:
Constant Field Values

MANIFEST_EXPORT

public static final int MANIFEST_EXPORT
Constant to represent MANIFEST_EXPORT element.

See Also:
Constant Field Values

MANIFEST_DEFINE

public static final int MANIFEST_DEFINE
Constant to represent MANIFEST_DEFINE element.

See Also:
Constant Field Values
Constructor Detail

Bundle

public Bundle(java.util.jar.JarOutputStream jarOutputStream)
Usage:
Contructor to create new Bundle and initialize default Manifest file values.

Parameters:
jarOutputStream - the output stream for the final Bundle archive file.
Method Detail

addImport

public void addImport(java.lang.String name,
                      java.lang.String type,
                      boolean optional,
                      boolean warn)
Usage:
To add an IMPORT element to the bundle and manifest.
Any existing IMPORT with the same name and type is overwritten.

Parameters:
name - the name of the element.
type - the type of the element.
optional - indicator set true for optional element.
warn - indicator for when optional is true. Value is ignored when optional is false.

addImport

public void addImport(java.lang.String name,
                      java.lang.String type)
Usage:
To add an IMPORT element to the bundle and manifest.
Any existing IMPORT with the same name and type is overwritten.

Parameters:
name - the name of the element.
type - the type of the element.

addImport

public void addImport(Manifest.Import impElement)

deleteImport

public void deleteImport(java.lang.String name,
                         java.lang.String type)
Usage:
To delete an IMPORT element from the bundle instance.
Existing IMPORT with the supplied name and type is deleted. If no element exists then there is no change.

Parameters:
name - the name of the element.
type - the type of the element.

addExport

public void addExport(java.lang.String name,
                      java.lang.String type)
Usage:
To add an EXPORT element to the bundle and manifest.
Any existing EXPORT with the same name and type is overwritten.

Parameters:
name - the name of the element.
type - the type of the element.

addExport

public void addExport(Manifest.Export expElement)

deleteExport

public void deleteExport(java.lang.String name,
                         java.lang.String type)
Usage:
To delete an EXPORT element from the bundle instance.
Existing EXPORT with the supplied name and type is deleted. If no element exists then there is no change.

Parameters:
name - the name of the element.
type - the type of the element.

addDefine

public void addDefine(java.lang.String name,
                      java.lang.String type,
                      java.lang.String path,
                      java.io.InputStream inputStream,
                      boolean optional,
                      boolean warn)
               throws java.io.IOException
Usage:
To add a DEFINE element and stream to the bundle and manifest.
(1)The manifest entry is written first and then (2)the stream is added to the bundle archive.

(1)Any existing Manifest DEFINE element with the same name and type is overwritten. If no element exists then there is no change.
(2)The supplied stream is added to the Bundle archive. If the file already exists in the archive an exception is thrown but the Manifest entry is already written.

Parameters:
name - the name of the element.
type - the type of the element.
path - the relative path of the stream to be added to the Bundle archive (Including filename).
inputStream - the stream to be added to the archive file.
optional - indicator set true for optional element.
warn - indicator for when optional is true. Value is ignored when optional is false.
Throws:
java.io.IOException

addDefine

public void addDefine(Manifest.Define defElement,
                      java.io.InputStream inputStream)
               throws java.io.IOException
Throws:
java.io.IOException

addDefine

public void addDefine(java.lang.String name,
                      java.lang.String type,
                      java.lang.String path,
                      java.io.InputStream inputStream)
               throws java.io.IOException
Usage:
To add a DEFINE element and stream to the bundle and manifest.
(1)The manifest entry is written first and then (2)the stream is added to the bundle archive.

(1)Any existing Manifest DEFINE element with the same name and type is overwritten. If no element exists then there is no change.
(2)The supplied stream is added to the Bundle archive. If the file already exists in the archive an exception is thrown but the Manifest entry is already written.

Parameters:
name - the name of the element.
type - the type of the element.
path - the relative path of the stream to be added to the Bundle archive (Including filename).
inputStream - the stream to be added to the archive file.
Throws:
java.io.IOException

deleteDefine

public void deleteDefine(java.lang.String name,
                         java.lang.String type)
Usage:
To delete a DEFINE element from the Manifest instance.
Note: Any files/streams written to the bundle archive will persist.
Existing DEFINE element with the supplied name and type is deleted from the Manifest. If no element exists then there is no change.

Parameters:
name - the name of the element.
type - the type of the element.

manifestEntryExist

public boolean manifestEntryExist(int elementType,
                                  java.lang.String name,
                                  java.lang.String type)
Usage:
To check if the Manifest instance contains an existence of the named element

Parameters:
elementType - the element type to search. See MANIFEST_IMPORT, MANIFEST_EXPORT, MANIFEST_DEFINE.
name - the name of the element.
type - the type of the element.
Returns:
returns true is entry exists.

addArchiveFile

public void addArchiveFile(java.lang.String path,
                           java.io.InputStream inputStream)
                    throws java.io.IOException
Usage:
Function to read in a stream and write it to the bundle archive file.

Parameters:
path - the location and file name of the data in the bundle archive.
inputStream - the data to be written to the bundle archive.
Throws:
java.io.IOException

writeArchive

public void writeArchive()
                  throws javax.xml.bind.JAXBException,
                         java.io.IOException
Usage:
This function should be called after all entries (DEFINEs, IMPORTs and EXPORTs) have been added to the Bundle archive.
The Manifest XML file is created and added to the Bundle archive.

Throws:
javax.xml.bind.JAXBException
java.io.IOException

writeManifest

public void writeManifest(java.io.OutputStream manifestOutStream)
                   throws javax.xml.bind.JAXBException,
                          java.io.IOException
Usage:
This function should be called after all entries (DEFINEs, IMPORTs and EXPORTs) have been added to the Manifest.
Only returns the Manifest file

Throws:
javax.xml.bind.JAXBException
java.io.IOException