Apache Software Foundation > Apache POI
 

HSSF Use Cases

HSSF Use Cases

Use Case 1: Read existing HSSF

Primary Actor: HSSF client

Scope: HSSF

Level: Summary

Stakeholders and Interests:

  • HSSF client- wants to read content of HSSF file
  • HSSF - understands HSSF file
  • POIFS - understands underlying POI file system

Precondition: None

Minimal Guarantee: None

Main Success Guarantee:

  1. HSSF client requests HSSF to read a HSSF file, providing an InputStream containing HSSF file in question.
  2. HSSF requests POIFS to read the HSSF file, passing the InputStream object to POIFS (POIFS use case 1, read existing file system)
  3. HSSF reads the "Workbook" file (use case 4, read workbook entry)

Extensions:

2a. Exceptions thrown by POIFS will be passed on to the HSSF client.

Use Case 2: Write HSSF file

Primary Actor: HSSF client

Scope: HSSF

Level: Summary

Stakeholders and Interests:

  • HSSF client- wants to write file out.
  • HSSF - knows how to write file out.
  • POIFS - knows how to write file system out.

Precondition:

  • File has been read (use case 1, read existing HSSF file) and subsequently modified or file has been created (use case 3, create HSSF file)

Minimal Guarantee: None

Main Success Guarantee:

  1. HSSF client provides an OutputStream to write the file to.
  2. HSSF writes the "Workbook" to its associated POIFS file system (use case 5, write workbook entry)
  3. HSSF requests POIFS to write its file system out, using the OutputStream obtained from the HSSF client (POIFS use case 2, write file system).

Extensions:

3a. Exceptions from POIFS are passed to the HSSF client.

Use Case 3:Create HSSF file

Primary Actor: HSSF client

Scope: HSSF

Level: Summary

Stakeholders and Interests:

  • HSSF client- wants to create a new file.
  • HSSF - knows how to create a new file.
  • POIFS - knows how to create a new file system.

Precondition:

Minimal Guarantee: None

Main Success Guarantee:

  1. HSSF requests POIFS to create a new file system (POIFS use case 3, create new file system)

Extensions: None

Use Case 4: Read workbook entry

Primary Actor: HSSF

Scope: HSSF

Level: Summary

Stakeholders and Interests:

  • HSSF - knows how to read the workbook entry
  • POIFS - knows how to manage the file system.

Precondition:

  • The file system has been read (use case 1, read existing HSSF file) or has been created and written to (use case 3, create HSSF file system; use case 5, write workbook entry).

Minimal Guarantee: None

Main Success Guarantee:

  1. HSSF requests POIFS for the "Workbook" file
  2. POIFS returns an InputStream for the file.
  3. HSSF reads from the InputStream provided by POIFS
  4. HSSF closes the InputStream provided by POIFS

Extensions:

3a. Exceptions thrown by POIFS will be passed on

Use Case 5: Write workbook entry

Primary Actor: HSSF

Scope: HSSF

Level: Summary

Stakeholders and Interests:

  • HSSF - knows how to manage the write the workbook entry.
  • POIFS - knows how to manage the file system.

Precondition:

  • Either an existing HSSF file has been read (use case 1, read existing HSSF file) or an HSSF file has been created (use case 3, create HSSF file).

Minimal Guarantee: None

Main Success Guarantee:

  1. HSSF checks the POIFS file system directory for the "Workbook" file (POIFS use case 8, read file system directory)
  2. If "Workbook" is in the directory, HSSF requests POIFS to replace it with the new workbook entry (POIFS use case 4, replace file in file system). Otherwise, HSSF requests POIFS to write the new workbook file, with the name "Workbook" (POIFS use case 6, write new file to file system)

Extensions:None

by Marc Johnson