bea.com | products | dev2dev | support | askBEA

Download Docs | Site Map | Glossary
Search

Programming BPM Client Apps

Managing the XML Repository

The XML repository provides a data storage facility for the business process components of WebLogic Integration.

This section explains how to manage the XML repository, including the following topics:

- Managing XML Repository Folders

- Managing XML Repository Entities

- Getting the EJB Environment Variable Values

For more information about the methods described in this section, see the com.bea.eci.repository.ejb.XMLRepository Javadoc.

Managing XML Repository Folders

The following sections describe how to create, update, display, and delete XML repository folders and subfolders.

Creating a Folder or Subfolder

To create a new folder or subfolder in the XML repository, use the following com.bea.wlpi.eci.repository.ejb.XMLRepository method:

>     public com.bea.wlpi.repository.helper.RepositoryFolderInfo createFolder (
>       java.lang.String type,
>       java.lang.String name,
>       java.lang.String desc,
>       java.lang.String notes,
>       com.bea.eci.repository.helper.RepositoryFolderInfo parent
>     ) throws com.bea.eci.repository.helper.RepositoryException,
>       java.rmi.RemoteException

The following table describes the createFolder() method parameters for which you must specify values.

Table 17-1 createFolder() Method Parameters

Parameter | Description | Valid Values
--- | --- | ---
type | Type of the folder being created. | String specifying a valid type from com.bea.eci.repository.helper.Types. ObjectFolder is currently the only valid type.
name | Name of the folder being created. | Non-null string that is unique within the repository for all ObjectFolder objects.
desc | Description of the folder being created. | String, which can be set to null.
notes | Notes for the folder being created. | String, which can be set to null.
parent | Parent folder for the child being created. | A RepositoryFolderInfo object specifying an existing folder, or null, to create a folder at the top level.

This method returns a list of com.bea.eci.repository.helper.RepositoryFolderInfo objects. To access information about each folder, use the RepositoryFolder object methods described in RepositoryFolderInfo Object.

For example, the following code creates a new folder named inventory within the folder factoryA. In this example, xmlrepository represents the EJBObject reference to the XMLRepository EJB.

>     RepositoryFolderInfo newFolder = xmlrepository.createFolder(
>       ObjectFolder, inventory, "Inventory of factory items.",
>       "This is a note.", "factoryA");

For more information about the createFolder() method, see the com.bea.eci.repository.ejb.XMLRepository Javadoc.

Getting All Folders and Subfolders

To get a list of all folders and subfolders in the XML repository or a list of subfolders corresponding to a particular folder, use the following com.bea.wlpi.eci.repository.ejb.XMLRepository methods, respectively:

>     public java.util.List getAllFolders(
>     ) throws com.bea.eci.repository.helper.RepositoryException,
>       java.rmi.RemoteException

>     public java.util.List getChildFolders(
>       com.bea.eci.repository.helper.RepositoryFolderInfo rfi
>     ) throws com.bea.eci.repository.helper.RepositoryException,
>       java.rmi.RemoteException

The following table describes the getChildFolders() method parameter for which you must specify a value.

Table 17-2 getChildFolders() Method Parameter

Parameter | Description | Valid Values
--- | --- | ---
rfi | Folder for which you want to view all subfolders. | An existing RepositoryFolderInfo object. If set to null, all folders that are not subfolders (that is, those that exist at the top level of the folder hierarchy) are retrieved. For information about getting a list of folders, see Getting All Folders and Subfolders.

Each method returns a list of com.bea.eci.repository.helper.RepositoryFolderInfo objects, or an empty list, if none are defined. To access information about each folder, use the RepositoryFolder object methods described in RepositoryFolderInfo Object.

For example, the following code gets a list of all folders. In this example, xmlrepository represents the EJBObject reference to the XMLRepository EJB.

>     List folders = xmlrepository.getAllFolders();

The following code gets a list of all subfolders for the specified parent, folderA:

>     List subfolders = xmlrepository.getChildFolders("folderA");

For more information about the getAllFolders() and getChildFolders() methods, see the com.bea.eci.repository.ejb.XMLRepository Javadoc.

Getting Folder Tree

To get a tree structure of all the folders in the XML repository, use the following com.bea.wlpi.eci.repository.ejb.XMLRepository method:

>     public javax.swing.tree.DefaultMutableTreeNode getObjectFolderTree(
>       javax.swing.tree.DefaultMutableTreeNode node
>     ) throws com.bea.eci.repository.helper.RepositoryException,
>       java.rmi.RemoteException

The following table describes the getObjectFolderTree() method parameter for which you must specify a value.

Table 17-3 getObjectFolderTree() Method Parameter

Parameter | Description | Valid Values
--- | --- | ---
node | Root node of the XML repository. | A DefaultMutableTreeNode object that represents the root of the XML repository.

This method returns a javax.swing.tree.DefaultMutableTreeNode representing the top node of the tree. Child folders of the specified node become the top-level folders in the tree. These folders are recursively populated with their respective children. Each child node consists of a DefaultMutableTreeNode object.

For example, the following code builds a tree from the root node. root represents a DefaultMutableTreeNode that you want to appear as the root of the tree. In this example, xmlrepository represents the EJBObject reference to the XMLRepository EJB.

>     javax.swing.tree.DefaultMutableTreeNode node =
>        xmlrepository.getObjectFolderTree(root);

For more information about the getObjectFolderTree method, see the com.bea.eci.repository.ejb.XMLRepository Javadoc.

Getting Folder Information

To get information for a folder in the XML repository, use one of the following com.bea.wlpi.eci.repository.ejb.XMLRepository methods.

Method 1

>     public com.bea.wlpi.eci.repository.helper.RepositoryFolderInfo getFolderInfo(
>       java.lang.String name
>     ) throws com.bea.eci.repository.helper.RepositoryException,
>       java.rmi.RemoteException

Method 2

>     public com.bea.wlpi.eci.repository.helper.RepositoryFolderInfo getFolderInfo(
>       java.lang.String type,
>       java.lang.String name
>     ) throws com.bea.eci.repository.helper.RepositoryException,
>       java.rmi.RemoteException

The following table describes the getFolderInfo() method parameters for which you must specify values.

Table 17-4 getFolderInfo() Method Parameters

Parameter | Description | Valid Values
--- | --- | ---
type | Type of the folder for which you want to get information. | String specifying a valid type from com.bea.eci.repository.helper.Types. ObjectFolder is currently the only valid type.
name | Name of the folder for which you want to get information. | An existing ObjectFolder object.

Each method returns a com.bea.eci.repository.helper.RepositoryFolderInfo object, or null, if the specified folder is not defined. To access information about the folder, use the RepositoryFolder object methods described in RepositoryFolderInfo Object.

For example, the following code gets the folder information for folderA. In this example, xmlrepository represents the EJBObject reference to the XMLRepository EJB.

>     com.bea.eci.repository.helper.RepositoryFolderInfo folderInfo =
>       xmlrepository.getFolderInfo("folderA");

For more information about the getFolderInfo() methods, see the com.bea.eci.repository.ejb.XMLRepository Javadoc.

Reorganizing Folders

To reorganize folders within the XML repository, use the following com.bea.wlpi.eci.repository.ejb.XMLRepository methods:

>     public void addChildFolder(
>       com.bea.eci.repository.helper.RepositoryFolderInfo child,
>       com.bea.eci.repository.helper.RepositoryFolderInfo parent
>     ) throws com.bea.eci.repository.helper.RepositoryException,
>       java.rmi.RemoteException

>     public void removeChildFolder(
>       com.bea.eci.repository.helper.RepositoryFolderInfo child,
>       com.bea.eci.repository.helper.RepositoryFolderInfo parent
>     ) throws com.bea.eci.repository.helper.RepositoryException,
>       java.rmi.RemoteException

The first method adds a child folder to a parent folder. The second removes a child folder from a parent folder.

Note: When a folder is removed from a parent, it is not also deleted from the XML repository.

The following table describes the addChildFolder() and removeChildFolder() method parameters for which you must specify values.

Table 17-5 addChildFolder() and removeChildFolder() Method Parameters

Parameter | Description | Valid Values
--- | --- | ---
child | Folder to be added to or removed from the specified parent folder. | An existing RepositoryFolderInfo object. For information about getting a list of folders, see Getting All Folders and Subfolders.
parent | Parent folder. | An existing RepositoryFolderInfo object. For information about getting a list of folders, see Getting All Folders and Subfolders.

For example, the following code moves folderA into folderB. In this example, xmlrepository represents the EJBObject reference to the XMLRepository EJB.

>     xmlrepository.addChildFolder("folderA", "folderB");

Similarly, the following code removes folderA from folderB:

>     xmlrepository.removeChildFolder("folderA", "folderB");

For more information about the addChildFolder() and removeChildFolder() methods, see the com.bea.eci.repository.ejb.XMLRepository Javadoc.

Renaming a Folder

To rename a folder in the XML repository, use the following com.bea.wlpi.eci.repository.ejb.XMLRepository method:

>     public void renameFolder(
>       java.lang.String curname,
>       java.lang.String newName
>     ) throws com.bea.eci.repository.helper.RepositoryException,
>       java.rmi.RemoteException

The following table describes the renameFolder() method parameters for which you must specify values.

Table 17-6 renameFolder() Method Parameters

Parameter | Description | Valid Values
--- | --- | ---
curName | Current name of the folder. | String specifying the name of an existing folder.
newName | New name for the folder. | String specifying a unique name for the new folder.

For example, the following code renames the existing folder, folderA, as folderB. In this example, xmlrepository represents the EJBObject reference to the XMLRepository EJB.

>     xmlrepository.renameFolder(folderA, folderB);

For more information about the renameFolder() method, see the com.bea.eci.repository.ejb.XMLRepository Javadoc.

Updating a Folder

To update the description and/or notes fields for a folder in the XML repository, use the following com.bea.wlpi.eci.repository.ejb.XMLRepository method:

>     public void updateFolder(
>       com.bea.eci.repository.helper.RepositoryFolderInfo rfi
>     ) throws com.bea.eci.repository.helper.RepositoryException,
>       java.rmi.RemoteException

The following table describes the updateFolder() method parameter for which you must specify a value.

Table 17-7 updateFolder() Method Parameter

Parameter | Description | Valid Values
--- | --- | ---
rfi | Folder name and type, and information to be updated. | A RepositoryFolderInfo object with the name and type fields set to identify the existing folder that you want to update, and the description and notes fields set to the new information.

For example, the following code updates the description and notes fields of an existing folder, as defined by the RepositoryFolderInfo object, folderInfo. In this example, xmlrepository represents the EJBObject reference to the XMLRepository EJB.

>     xmlrepository.updateFolder(folderInfo);

For more information about the updateFolder() method, see the com.bea.eci.repository.ejb.XMLRepository Javadoc.

Deleting a Folder

To delete a folder from the XML repository, use the following com.bea.wlpi.eci.repository.ejb.XMLRepository method:

>     public void deleteFolder(
>       com.bea.eci.repository.helper.RepositoryFolderInfo rfi
>     ) throws com.bea.eci.repository.helper.RepositoryException,
>       java.rmi.RemoteException

The following table describes the deleteFolder() method parameter for which you must specify a value.

Table 17-8 deleteFolder() Method Parameter

Parameter | Description | Valid Values
--- | --- | ---
rfi | Folder to be deleted. | An existing RepositoryFolderInfo object associated with the folder to be deleted. The specified folder must not contain any subfolders. For information about getting folder information, see Getting Folder Information.

XML entities contained within the folder being deleted are not deleted from the XML repository. XML entities become entities at the top level of the hierarchy.

For example, the following code deletes the folder defined by the RepositoryFolderInfo object, folderInfo. In this example, xmlrepository represents the EJBObject reference to the XMLRepository EJB.

>     xmlrepository.deleteFolder(folderInfo);

For more information about the deleteFolder() method, see the com.bea.eci.repository.ejb.XMLRepository Javadoc.

Managing XML Repository Entities

The following sections describe how to create, update, display, and delete XML repository entities.

Creating an Entity

To create an XML repository entity, use the following com.bea.wlpi.eci.repository.ejb.XMLRepository method:

>     public com.bea.eci.repository.helper.XMLEntityInfo createEntity(
>       int type,
>       java.lang.String name,
>       java.lang.String desc,
>       java.lang.String notes,
>       java.lang.String content,
>       com.bea.eci.repository.helper.RepositoryFolderInfo parent
>     ) throws com.bea.eci.repository.helper.RepositoryException,
>       java.rmi.RemoteException

The following table describes the createEntity() method parameters for which you must specify values.

Table 17-9 createEntity() Method Parameters

Parameter | Description | Valid Values
--- | --- | ---
type | Type of the entity being created. | Integer specifying a valid type from com.bea.eci.repository.helper.Types. Valid values include: NO_CONTENT: No content (default) TEXT: Text DTD: Document Type Definition (DTD) XML_SCHEMA: XML schema XML: XML XSLT: XML Transformation Document (XSLT) MFL: Message Format Language (MFL)
name | Name of the entity being created. | Non-null string that is unique within the repository for all XMLEntityInfo objects.
desc | Description of the entity being created. | String, which can be set to null.
notes | Notes for the entity being created. | String, which can be set to null.
parent | Parent folder for the entity being created. | A RepositoryFolderInfo object. If set to null, an entity is created at the top level. For information about getting folder information, see Getting Folder Information.

This method returns the com.bea.eci.repository.helper.XMLEntityInfo object corresponding to the new entity. To access information about the entity, use the XMLEntityInfo object methods described in XMLEntityInfo Object.

For example, the following code creates a new XML entity named widgets in the inventory folder. In this example, xmlrepository represents the EJBObject reference to the XMLRepository EJB.

>     XMLEntityInfo entity = xmlrepository.createEntity(Types.XML, "widgets", "widgets inventory", "This is a note.", inventory);

For more information about the createEntity() method, see the com.bea.eci.repository.ejb.XMLRepository Javadoc.

Getting Entities

To get a list of all entities in the XML repository, or a list of entities within a specified folder, use the following com.bea.wlpi.eci.repository.ejb.XMLRepository methods, respectively:

>     public java.util.List getAllEntities(
>     ) throws com.bea.eci.repository.helper.RepositoryException,
>       java.rmi.RemoteException

>     public java.util.List getChildDocs(
>       com.bea.eci.repository.helper.RepositoryFolderInfo rfi
>     ) throws com.bea.eci.repository.helper.RepositoryException,
>       java.rmi.RemoteException

The following table describes the getChildDocs() method parameter for which you must specify a value.

Table 17-10 getChildDocs() Method Parameter

Parameter | Description | Valid Values
--- | --- | ---
rfi | Folder for which entities should be listed. | A RepositoryFolderInfo object associated with the folder for which entities should be listed. If this value is set to null, all entities not contained in a folder are retrieved. For information about getting folder information, see Getting Folder Information.

Each method returns a list of com.bea.eci.repository.helper.XMLEntityInfo objects, or an empty list, if no entities are defined. The XMLEntityInfo objects do not contain the entity object contents; they contain only the name, type, and meta-data. To access information about each entity, use the XMLEntityInfo object methods described in XMLEntityInfo Object.

For example, the following code gets a list of all entities. In this example, xmlrepository represents the EJBObject reference to the XMLRepository EJB.

>     List entities = xmlrepository.getAllEntities();

The following code gets a list of all entities within folderA:

>     List entities = xmlrepository.getChildDocs("folderA");

For more information about the getAllEntities() and getChildDocs() methods, see the com.bea.eci.repository.ejb.XMLRepository Javadoc.

Getting Entity Information

To get information for an entity in the XML repository, use one of the following com.bea.wlpi.eci.repository.ejb.XMLRepository methods.

Method 1

>     public com.bea.wlpi.eci.repository.helper.XMLEntityInfo getEntity(
>       java.lang.String name
>     ) throws com.bea.eci.repository.helper.RepositoryException,
>       java.rmi.RemoteException

Method 2

>     public com.bea.wlpi.eci.repository.helper.XMLEntityInfo getEntity(
>       java.lang.String name,
>       int type
>     ) throws com.bea.eci.repository.helper.RepositoryException,
>       java.rmi.RemoteException

The first method supports entities with single-content fields. If multiple-content fields exist, the method returns only the contents of the first type encountered. The second method supports entities with multiple-content fields: it allows you to specify the type of content that you want to retrieve.

The following table describes the getEntity() method parameters for which you must specify values.

Table 17-11 getEntity() Method Parameters

Parameter | Description | Valid Values
--- | --- | ---
name | Name of the entity for which you want to get information. | String specifying the name of a valid XMLEntityInfo object.
type | Type of the entity for which you want to get information. | Integer specifying a valid type from com.bea.eci.repository.helper.Types. Valid values include: NO_CONTENT: No content (default) TEXT: Text DTD: Document Type Definition (DTD) XML_SCHEMA: XML schema XML: XML XSLT: XML Transformation Document (XSLT) MFL: Message Format Language (MFL)

Each method returns a com.bea.eci.repository.helper.XMLEntityInfo object, or null, if the specified entity is not defined. To access information about the entity, use the XMLEntityInfo object methods described in XMLEntityInfo Object.

For example, the following code gets entity information for entityA. In this example, xmlrepository represents the EJBObject reference to the XMLRepository EJB.

>     com.bea.eci.repository.helper.XMLEntityInfo entityInfo =
>       xmlrepository.getEntity("entityA");

For more information about the getEntity() methods, see the com.bea.eci.repository.ejb.XMLRepository Javadoc.

Organizing Entities Within Folders

To organize entities within folders in the XML repository, use the following com.bea.wlpi.eci.repository.ejb.XMLRepository methods:

>     public void addEntityToFolder(
>       com.bea.eci.repository.helper.XMLEntityInfo xei,
>       com.bea.eci.repository.helper.RepositoryFolderInfo rfi
>     ) throws com.bea.eci.repository.helper.RepositoryException,
>       java.rmi.RemoteException

>     public void removeEntityFromFolder(
>       com.bea.eci.repository.helper.XMLEntityInfo xei,
>       com.bea.eci.repository.helper.RepositoryFolderInfo rfi
>     ) throws com.bea.eci.repository.helper.RepositoryException,
>       java.rmi.RemoteException

The first method adds an entity to a folder. The second method removes an entity from a folder.

Note: When an entity is removed from a folder, it is not also deleted from the XML repository.

The following table describes the addEntityToFolder() and removeEntityFromFolder() method parameters for which you must specify values.

Table 17-12 addEntityToFolder() and removeEntityFromFolder() Method Parameters

Parameter | Description | Valid Values
--- | --- | ---
xei | Entity to be added to or removed from the specified parent folder. | An existing XMLEntityInfo object. For information about getting a list of entities, see Getting Entities.
rfi | Parent folder. | An existing RepositoryFolderInfo object. For information about getting a list of folders, see Getting All Folders and Subfolders.

For example, the following code moves entityA into folderA. In this example, xmlrepository represents the EJBObject reference to the XMLRepository EJB.

>     xmlrepository.addEntityToFolder("entityA", "folderA");

Similarly, the following code removes entityA from folderA:

>     xmlrepository.removeEntityFromFolder("entityA", "folderA");

For more information about the addEntityToFolder() and removeEntityFromFolder() methods, see the com.bea.eci.repository.ejb.XMLRepository Javadoc.

Renaming an Entity

To rename an entity in the XML repository, use the following com.bea.wlpi.eci.repository.ejb.XMLRepository method:

>     public void renameEntity(
>       java.lang.String curname,
>       java.lang.String newName
>     ) throws com.bea.eci.repository.helper.RepositoryException,
>       java.rmi.RemoteException

The following table describes the renameEntity() method parameters for which you must specify values.

Table 17-13 renameEntity() Method Parameters

Parameter | Description | Valid Values
--- | --- | ---
curName | Current name of the entity. | String specifying the name of an existing entity.
newName | New name for the entity. | String specifying a unique name for the new entity.

For example, the following code renames the existing entity, entityA, as entityB. In this example, xmlrepository represents the EJBObject reference to the XMLRepository EJB.

>     xmlrepository.renameEntity(entityA, entityB);

For more information about the renameEntity() method, see the com.bea.eci.repository.ejb.XMLRepository Javadoc.

Updating an Entity

To update the description, notes, and/or contents fields for an entity in the XML repository, use the following com.bea.wlpi.eci.repository.ejb.XMLRepository method:

>     public void updateEntity(
>       com.bea.eci.repository.helper.XMLEntityInfo xei
>     ) throws com.bea.eci.repository.helper.RepositoryException,
>       java.rmi.RemoteException

The following table describes the updateEntity() method parameter for which you must specify a value.

Table 17-14 updateEntity() Method Parameters

Parameter | Description | Valid Values
--- | --- | ---
xei | Entity and information to be updated. | An XMLRepositoryInfo object with the name and type fields set to identify the existing entity that you want to update, and the description, notes, and contents fields set to the new information.

You can update only a single-contents field, corresponding to the type specified in the type field of the XMLRepositoryInfo object, regardless of whether or not the entity has multiple content types.

For example, the following code updates the description, notes, and contents fields of an existing entity, as defined by the XMLRepository object, entityInfo. In this example, xmlrepository represents the EJBObject reference to the XMLRepository EJB.

>     xmlrepository.updateEntity(entityInfo);

For more information about the updateEntity() method, see the com.bea.eci.repository.ejb.XMLRepository Javadoc.

Deleting an Entity

To delete an entity from the XML repository, use the following com.bea.wlpi.eci.repository.ejb.XMLRepository method:

>     public void deleteEntity(
>       com.bea.eci.repository.helper.XMLEntityInfo xei
>     ) throws com.bea.eci.repository.helper.RepositoryException,
>       java.rmi.RemoteException

The following table describes the deleteEntity() method parameter for which you must specify a value.

Table 17-15 deleteEntity() Method Parameters

Parameter | Description | Valid Values
--- | --- | ---
xei | Entity to be deleted. | An existing XMLEntityInfo object associated with the entity to be deleted. For information about getting entity information, see Getting Entity Information. The only required field in the XMLEntityInfo object is the name field, which uniquely identifies the entity.

For example, the following code deletes the folder defined by the XMLEntityInfo object, entityInfo. In this example, xmlrepository represents the EJBObject reference to the XMLRepository EJB.

>     xmlrepository.deleteEntity(entityInfo);

For more information about the deleteEntity() method, see the com.bea.eci.repository.ejb.XMLRepository Javadoc.

Getting the EJB Environment Variable Values

To get a list of the EJB environment variable values used for connections to the XML repository, use the following com.bea.wlpi.eci.repository.ejb.XMLRepository method:

>     public java.util.List getEnvVars(
>     ) throws java.rmi.RemoteException

This method returns the following list of environment variable values used to connect to the repository, in the order specified:

- Connection

- Transactional data source name

- JDBC class

- JDBC URL

- JDBC server

For example, the following code gets a list of the environment variables being used. In this example, xmlrepository represents the EJBObject reference to the XMLRepository EJB.

>     List envVars = xmlrepository.getEnvVars();

For more information about the getEnvVars() method, see the com.bea.eci.repository.ejb.XMLRepository Javadoc.