This directory contains sample programs using the DB2 Information Integrator for Content JavaBeans. Most of these samples are general and can be used either directly with a content server or indirectly via a federated connection, using federated entities and search templates that were defined using the administration client.
All samples can be executed in the DB2 Information Integrator for Content environment. To set up:
AIX, Solaris
Execute the cmbenv81.sh script. (On AIX, this script is located in the $IBMCMROOT/bin directory.) This script sets up the PATH and CLASSPATH correctly for compiling and running the samples.
To run the TXMLRunRequest sample, you must pass in the command-line parameterxmlsdkto thecmbenv81.shscript file.
cmbenv81.sh xmlsdk
Passing in this parameter will ensure that all the necessary jar files for parsing XML are included in the PATH and CLASSPATH.
Samples that use CMBDocumentServices also require X Server. (The document conversions within CMBDocumentServices use the AWT, which requires X11 Graphics Session.) A root user can enable the use of its X11 Graphics Session using the command:xhost +
This gives permission to all users. Each user can then set the DISPLAY environment variable:
set DISPLAY 0:0
export DISPLAY
Windows NT, 2000
Execute the cmbenv81.bat file. (On Windows, this script is located in the %IBMCMROOT%/bin directory.) This script sets up the PATH and CLASSPATH correctly for compiling and running the samples.
To run the TXMLRunRequest sample, you must pass in the command-line parameterxmlsdkto thecmbenv81.batfile.
cmbenv81.bat xmlsdk
Passing in this parameter will ensure that all the necessary jar files for parsing XML are included in the PATH and CLASSPATH.
There are three types of samples in this directory:
Note: These samples are not demo or turn-key programs that will run without any customization. The user must customize them to make them run in his/her environment. The main purpose of these sample programs is to provide sample code for the user to browse, so that he/she can have a clear example of how to perform a certain task using the II4C JavaBeans.
These samples are interactive, prompting for information from the user. The following table describes each sample class in more detail.
These samples require a federated connection.
| Class Name | Description |
| DemoConnect | Performs a connect and disconnect. Demonstrates the use of the CMBConnection bean. |
| DemoConnectUsingEvent | Demonstrates connection using request/reply events. |
| DemoSchema | Demonstrates CMBSchemaManagement bean functionality. |
| DemoAsynchSearch | Demonstrates asynchronous search using search templates (obtained from CMBSchemaManagement) and iterating through search results (using CMBSearchResults). |
| DemoDataMgt | Demonstrates CMBDataManagement bean functionality. |
| DemoSimpleAppl | A simple sample application, to demonstrate using nonvisual beans to build a simple command line application. |
| UtilSimpleUI | Provides simple command line user interface methods. |
| UtilPersistent | Saves and restores bean state using Java serialization. |
These samples demonstrate the creation of visual beans that work with the nonvisual beans using request and reply events. Several sample visual beans are provided.
These samples require a federated connection.
| Class Name | Description |
| SampleGuiLogon | Provides logon panel for the CMBConnection bean. |
| SampleGuiSchema | Provides a list of search templates. |
| SampleGuiTemplate | Provides a query interface for a search template. |
| UtilTableModel | Provides a Swing table model for search results. |
| TemplateChangeEvent | An event fired from the SampleGuiSchema bean when a template is selected. |
| TemplateChangeListener | The listener for the TemplateChangedEvent, implemented by SampleGuiTemplate. |
| SampleFocusAdapter | Provides serialization to FocusAdapter |
These samples perform various tasks using the beans without interaction. All parameters to the samples are provided as arguments.
These samples can be used either directly with the specified server type, or indirectly via a federated connection.
| Class Name | Description |
| TListDataSources | Lists the servers available. |
| TConnect | Performs connect and disconnect from the server. |
| TConnectionPool | Demonstrates the use of connection pool to get and free connections. |
| TChangePassword | Change password on server. |
| TListEntities | Lists entities and their attributes as defined on the server. Recurses to show subentities (child component types). |
| TListTemplates | Lists search templates as defined on the server. |
| TSearch | Searches using a query string. Also displays contents of folders and attributes on child components. |
| TAsynchSearch | Similar to TSearch, but performs an asynchronous search. |
| TCreateItem | Creates an item, specifying the attributes, including child components if any. |
| TImport | Imports a document or resource item, specifying attributes and content. |
| TExport | Writes document or resource item content to a file. |
| TView | Searches, retrieves and views documents with conversion. |
| TLock | Locks a document |
| TUnlock | Unlocks a document |
| TEditAttributes | Changes values of item attributes. Also, adds, updates, or removes child components on an item. |
| TReindex | Reindexes item, moving it to another entity. |
| TCreateFolder | Creates a folder. |
| TAddToFolder | Adds an item to a folder. |
| TListRefFolders | Lists folders that an item belongs to. |
| TRemoveFromFolder | Removes an item from a folder. |
| TAddLink | Creates a link between items. |
| TRemoveLink | Removes a link between items. |
| TListLinks | Lists links between items. |
| TDelete | Deletes an item. |
| TAddAnnotation | Adds a text annotation to a document or folder. |
| TUpdateNotelog | Appends text to the note log on a document or folder. If a note log does not exist, one is created. |