ArchiveAccessor V 1.0


ArchiveAccessor Bean Suite

User's Guide


Table Of Contents


toc

Introduction

The Introduction part of this document includes the following information:


Purpose of the Suite

The ArchiveAccessor Bean Suite provides the user with an easy way of working with an archive file as an object. Now the ArchiveAccessor Bean Suite can operate with the Jar and Zip files.


up Audience

This document describes the ArchiveAccessor Bean Suite. It is intended for application assemblers who can use the component in a visual builder as well as in manual programming. It is assumed that they are already familiar with JavaBeans. If terms like property, event, method, introspection, or serialization are unfamiliar to them, they may refer to the JavaBeans documentation or take the JavaBeans tutorial.


up How to Use This Guide

Guide Conventions

Typographical Conventions
Conventions Description Example
Text in bold buttons and field names of dialog boxes OK, Cancel, Port, Socks Server, etc.
Text in italics names of dialog boxes, figures, reference to chapters and other sections, task name, etc. Confirm dialog, Figure 1, Overview, etc.
  • Round bullets
list of points When leaving on vacation, remember to take:
  • some sunglasses,
  • tickets,
  • a swimming suit,
  • lots of money.
Numbered list 1, 2, 3, .... sequential steps When going on vacation:
  1. get to the airport,
  2. buy a ticket,
  3. check in the luggage,
  4. get on the airplane.
Text in Bold and Italics a file name xxxx.zip
Text in Courier font names of classes, methods, events, part of code included in the document, etc. ActionPerformed, DispMes

Mouse Conventions

Conventions Description Example
Select Click the left mouse button Select the File menu.

Keyboard Conventions

Keys Represented
Control Ctrl

Images

Image Used for
previous navigating to the previous logical page
next navigating to the next logical page
up navigating to the one-level-higher heading
glossary navigating to the Glossary of Terms
toc returning to the Table of Contents
note representing Note information

Guide Organization

Introduction - introduces a user to the ArchiveAccessor Bean Suite. Provides information as intended audience, guide conventions, guide organization, and copyrights.

Component Description - describes the ArchiveAccessor Bean Suite in general.

Installation Instructions - describes the hardware and software required for installing and using the ArchiveAccessor Bean Suite.

Usage Instructions - provides information on bean usage, deployment, wiring scenarios, and serialization.

Individual Bean Documentation - provides links to individual bean documentation which describes beans in terms of its events, properties, methods, etc.

Demo Applications - describes demo applications and provides instructions on how to run the demo applications.


Copyrights and trademarks

Copyright © 1998 IBM Corp.

All rights reserved.

IBM and VisualAge are trademarks of International Business Machines in the United States and/or other countries.

* Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.

Copyright © 1997 The Open Group

Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appears in all copies and that both the copyright notice and this permission notice appear in supporting documentation, and that the name of ("TOG") or the Open Group is not used in advertising or publicity pertaining to distribution of the software without specific, written prior permission.

THE OPEN GROUP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL TOG BE LIABLE FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

The Open Group Research Institute MoaJar (unencumbered) 3/20/1997


toc

Component Description

Domain Concepts

The ArchiveAccessor Bean Suite is a set of non-visual components that can be used in RAD tools and allows an application assembler an easy access to an archive file.


General Description

The ArchiveAccessor Bean Suite now includes two non-visual beans intended to organize visual work process with archives.

The JarFileAccessor Bean covers functionality of the JAR.EXE command and performs the following functions:

The ZipFileAccessor Bean performs the following functions:


toc

Installation Instructions

Hardware Requirements

The ArchiveAccessor Bean Suite is designed to be compliant with 100% Pure Java requirements, and therefore, can serve on any hardware platform that supports the Java Environment.

The archiveaccessor.jar file takes about 70 KB of the disk space. This includes all of the customization classes as well.

Additional hard disk space is required to install the Java Development Kit, Bean Development Kit, or any Java Application Builder Tool which are used for building/compiling applications while using these beans.


up Software Requirements

The ArchiveAccessor Bean Suite completely corresponds to the JavaBeans specification and has been successfully tested by IBM's VisualAge for Java. It can be also used in any other builder tools supporting JavaBeans after taking in account their restrictions. For example, it is possible to connect any event visually only with an non-void method with 0-1 parameters  in Symantec VisualCafe.


up Installation

  1. Using the ArchiveAccessor Bean Suite as JavaBeans

To use the ArchiveAccessor Bean Suite as JavaBeans, import JAR file archiveaccessor.jar into a particular builder tool that you are using.

For example, to use beans inside Symantec Visual Cafe, select Component into the Library command in the Insert menu and choose archiveaccessor.jar in the File dialog . You will see the ArchiveAccessor beans in the Component Library window.

  1. Using the ArchiveAccessor Bean Suite via the APIs Provided

To use the ArchiveAccessor Bean Suite in an application, you should have the archiveaccessor.jar file in your CLASSPATH. You should read the JavaDoc API documentation provided to find out more about APIs that the component supports. You can also see the demo application source code.

  1. To start the Demo Applications, set  CLASSPATH for array.jar and uicontrols.jar (You can download array.jar and uicontrols.jar libraries from alphaWorks (www.alphaworks.ibm.com).), then call the following commands:

run_jfa_demo.bat - to start the Demo Application for the JarFileAccessor bean,
run_zfa_demo.bat - to start the Demo Application for the ZipFileAccessor bean.

Follow the instructions in the corresponding readme_jfa_demo.txt and readme_zfa_demo.txt files.


up Platform Dependencies

The ArchiveAccessor Bean Suite is designed to work with Java Development Kit Version 1.1 and above.


toc

Usage Instructions

Deployment Scenario

Suppose, the Application Assembler creates an application which should save files in the archive of a jar type and read them from the archive. It is easier and more convenient to use the JarFileAccessor Bean for this.

The Application Assembler should put the JarFileAccessor Bean on the design surface and set archive properties which s/he is going to use. For example, s/he should set a Jar file name, a default directory where added and extracted files will be inserted; decide if the manifest file will be created and if s/he is going to use the automatic mode of change saving and  the algorithm compression mode.

Then the Application Assembler can perform wiring of different visual objects with bean methods. For example,

Default properties of a new archive will be the same as of an old one. The Application Assembler can reset these properties by using a block of the "set" methods and get a value of any property by using a block of the "get" methods.

The deployment scenario for creating an application, which should save files in the archive of a zip type and read them from the archive using the ZipFileAccessor bean for this, is the same.

The end user does not interact with this component.


up Bean Usage

JAR file archiveaccessor.jar with the JarFileAccessor and ZipFileAccessor beans should be added to the IDE by means of the standard installation procedure for a given IDE. For example, see the Installation part of this document.

The wiring scenario is described below.


up Wiring Scenario

JarFileAccessor Bean

To perform this part of the task described in Deployment Scenario,  the user should put the following on the design surface:

  1. JarFileAccessor
  2. Text field (NameDirectory)
  3. Text field (NameFile)
  4. Button (CreateJar)

Wiring

  1. Wire the text property of the NameDirectory field with the defaultDirectory property of JarFileAccessor. For this connection  the source of event is the  text property.
  2. Wire the  text property of the NameFile field with the archiveName property of JarFileAccessor. For this connection  the source of event is the text property.
  3. Wire actionPerform of the CreateJar button with the create() method of JarFileAccessor.
  4. Wire actionPerform of the CreateJar button with the add() method of JarFileAccessor.
  5. Wire actionPerform of the CreateJar button with the save() method of JarFileAccessor.
  6. Wire actionPerform of the CreateJar button with the close() method of JarFileAccessor.

ZipFileAccessor Bean

To perform this part of the task described in Deployment Scenario, the user should put the following on the design surface:

  1. ZipFileAccessor
  2. Text field (NameDirectory)
  3. Text field (NameFile)
  4. Button (CreateZip)

Wiring

  1. Wire the text property of the NameDirectory field with the defaultDirectory property of ZipFileAccessor. For this connection  the source of event is the text property.
  2. Wire the text property of the NameFile field with the archiveName property of ZipFileAccessor. For this connection  the source of event is the text property.
  3. Wire actionPerform of the CreateZip button with the create() method of ZipFileAccessor.
  4. Wire actionPerform of the CreateZip button with the add() method of ZipFileAccessor.
  5. Wire actionPerform of the CreateZip button with the save() method of ZipFileAccessor.
  6. Wire actionPerform of the CreateZip button with the close() method of ZipFileAccessor.

up Serialization

The ArchiveAccessor Bean Suite implements the Serializable interface, and a default mechanism for serialization can be applied without any change.


toc

Individual Bean Documentation

This part provides a link to the individual ArchiveAccessor Bean Suite documentation which describes the Suite in terms of its events, properties, methods, etc.


toc

Demo Applications

The demo directory includes two demo applications:

Besides the ArchiveAccessor Bean Suite, the demo applications include the Array Bean Set package and the UIControls package beans.

To start the Demo Applications, set CLASSPATH of array.jar and uicontrols.jar (You can download array.jar and uicontrols.jar libraries from alphaWorks (www.alphaworks.ibm.com).), then call the following commands:

run_jfa_demo.bat - to start the Demo Application for the JarFileAccessor bean,
run_zfa_demo.bat - to start the Demo Application for the ZipFileAccessor bean.

Follow the instructions in the corresponding readme_jfa_demo.txt and readme_zfa_demo.txt files.


up Demo for Jar Type File

Wiring is to be done in the following way:

1. Download the following items in the repository:

2. Put on the design surface:

3. Wiring:

  1. Wire the text field  of "Default Directory" with the DefaultDirectory property. Set  the textValueChanged(...) property for the Source Event for this wiring.
  2. Button Create Jar-file ActionPerform ---> create() for the Jar bean.
    The result branches out:
    a). an exception - a note in the Status bar: "Default Directory is not defined";
    b). a normal wiring result - a note in the Status Bar: "READY";
    c). a normal wiring result --->
    removeAll() for ExtendedList;
    d). a normal wiring result --->
    contents() for the JarFileAccessor bean;
    a normal result of connection d). ---> addArray(Object) for ExtendedList.
  3. Button Add File:
              ActionPerform --->
    add(String) for the JarFileAccessor bean;
              Set the text property of the File Name to Add/Extract field as a parameter of this wiring.
              The result branches out:
                       a). an exception - set the text property for the Status bar: "Can't add a file to the archive";
                       b). a normal wiring result --> the text property for the Status bar: "READY";
                       c). a normal wiring result --->
    removeAll() for ExtendedList;
                       d). a normal wiring result --->
    contents() for the JarFileAccessor bean;
               a normal result of connection d). --->
    addArray(Object) for ExtendedList.
  4. Button Extract File:
    ActionPerform ---> extract(String) for the JarFileAccessor bean;
    Set the text property of the File Name to Add/Extract field as a parameter of this wiring.
  5. Button Open:
               ActionPerform --->
    open(String) for the JarFileAccessor bean;
               Set the text property of the Archive Name field as a parameter of this wiring.
               The result branches out:
                        a). an exception -- set the text property for the Status bar: "Can't open an archive";
                        b). a normal wiring result --> set the text property for the Status bar: "Archive is open";
                        c). a normal wiring result --->
    removeAll() for ExtendedList;
                        d). a normal wiring result --->
    contents() for the JarFileAccessor bean;
                a normal result of connection d). --->
    addArray(Object) for ExtendedList.
  6. Button Extract Archive:
                ActionPerform --->
    extract() for the JarFileAccessor bean;
                The result branches out:
                         an exception -- set the text property for the Status bar: "Can't extract an archive";
                         a normal wiring result --> set the text property for the Status bar: "Ready";
  7. Wire event windowClosing of the main window with event to script exitApp().
                        
    public void exitApp( ) {
                                System.exit(0);
                                }
  8. ExtendedList:
                 
    itemStateChanged(...) --> getSelectedItem();
                  a normal wiring result --> set the text property for File Name to Add/Extract.
  9. Wire the windowOpened event for the main window with the text property for the ArchiveName field.
  10. Set "Untitled.jar" constant as a parameter of the previous wiring.
  11. Wire the text field of "Archive Name" with the archiveName property. Set  the textValueChanged(...) property for the Source Event for this wiring.

The Demo Application functionality is very simple: the user can type a default directory name and a name of an archive. Then press the Create Jar-file button to create a new jar file. When the task is done, the user can see a list of files in the corresponding list box. The user can add/extract files to/from the archive, save it, and so on.

The user can experiment with the Demo Application as much as s/he likes to get used to a component.

The wiring diagram looks this way:

WiringJar.gif (14736 bytes)

Figure 1 - JarFileAccessor Wiring Diagram.

The sample screen of the Demo Application is as follows:

DemoJar

Figure 2 - Demo Application Sample.

where


up Demo for Zip Type File

Wiring is to be done this way:

1. Download the following items in the repository:

  1. UIControls,
  2. Arrays (ExtendedList needed),
  3. ZipFileAccessor.

2. Put on the design surface:

3. Wiring:

  1. Wire the text field  of "Default Directory" with the DefaultDirectory property. Set  the textValueChanged(...) property for the Source Event for this wiring.
  2. Button Create Zip-file ActionPerform ---> create() for the ZipFileAccessor bean.
    The result branches out:
    a). an exception - a note in the Status bar: "Default Directory is not defined";
    b). a normal wiring result - a note in the Status Bar: "READY";
    c). a normal wiring result --->
    removeAll() for ExtendedList;
    d). a normal wiring result --->
    contents() for the ZipFileAccessor bean;
    a normal result of connection d). ---> addArray(Object) for ExtendedList.
  3. Button Add File in Archive:
              ActionPerform --->
    add(String) for the ZipFileAccessor bean;
              Set the text property of the File Name to Add/Extract field as a parameter of this wiring.
              The result branches out:
                       a). an exception - set the text property for the Status bar: "Can't add a file to the archive";
                       b). a normal wiring result --> the text property for the Status bar: "READY";
                       c). a normal wiring result --->
    removeAll() for ExtendedList;
                       d). a normal wiring result --->
    contents() for the ZipFileAccessor bean;
               a normal result of connection d). --->
    addArray(Object) for ExtendedList.
  4. Button Extract File:
    ActionPerform ---> extract(String) for the ZipFileAccessor bean;
    Set the text property of the File Name to Add/Extract field as a parameter of this wiring.
  5. Button Open:
               ActionPerform --->
    open(String) for the ZipFileAccessor bean;
               Set the text property of the Archive Name field as a parameter of this wiring.
               The result branches out:
                        a). an exception -- set the text property for the Status bar: "Can't open an archive";
                        b). a normal wiring result --> set the text property for the Status bar: "Archive is open";
                        c). a normal wiring result --->
    removeAll() for ExtendedList;
                        d). a normal wiring result --->
    contents() for the ZipFileAccessor bean;
                a normal result of connection d). --->
    addArray(Object) for ExtendedList.
  6. Button Extract:
                ActionPerform --->
    extract() for the ZipFileAccessor bean;
                The result branches out:
                         an exception -- set the text property for the Status bar: "Can't extract an archive";
                         a normal wiring result --> set the text property for the Status bar: "Ready";
  7. Wire event windowClosing of the main window with event to script exitApp().
                        
    public void exitApp( ) {
                                System.exit(0);
                                }
  8. ExtendedList:
                 
    itemStateChanged(...) --> getSelectedItem(),
                  a normal wiring result --> set the text property for File Name to Add/Extract.
  9. Wire the windowOpened event for the main window with the text property for the ArchiveName field.
  10. Set "Untitled.zip" constant as a parameter of this wiring.
  11. Wire the text field of "Archive Name" with the archiveName property. Set the textValueChanged(...) property for the Source Event for previous wiring.

The Demo application functionality is very simple: the user can type a default directory name and an archive name. Then press the Creates Zip-file button to create a new Zip file. When the task is done, the user can see a list of files in the corresponding list box. The user can add/extract files to/from the archive, save it, and so on.

The user can experiment with the Demo Application as much as s/he likes to get used to a component.

The wiring diagram looks this way:

WiringZip.gif (17100 bytes)

Figure 3 - ZipFileAccessor Wiring Diagram.

The sample screen of the Demo Application is as follows:

DemoJar

Figure 4 - Demo Application Sample.

where


Go back to

previous

ArchiveAccessor Bean Suite Documentation Index

Last Modified : 08/28/98