Using Integration Controls

     Previous  Next    Open TOC in new window  Open Index in new window  View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

XML MetaData Cache Control

Sharing Data Within a Cluster

Note: The WebLogic Integration is available in BEA Workshop for WebLogic Platform only if you are licensed to use WebLogic Integration.
Note: The XML MetaData Cache is managed using the WebLogic Integration Administration Console or the MBean API, which allows users to create their own NetUI based consoles. The WebLogic Integration can be used to retrieve XML metadata that is present in the XML MetaData Cache.

 


Topics Included in This Section

Overview: WebLogic Integration

Describes the WebLogic Integration and its features.

Sharing Cache Data Within a Cluster

Describes how cached data is shared across a cluster and made available to requesting nodes.

Creating an WebLogic Integration in WebLogic Integration

Describes how to create a new WebLogic Integration within WebLogic Integration.

Understanding the WebLogic Integration Get Method

Describes how to retrieve XML metadata using the get method of the WebLogic Integration.

Using the WebLogic Integration In a Business Process

Describes how to use the WebLogic Integration in a business process.

Example: WebLogic Integration

Describes a scenario in which the WebLogic Integration is used.

Overview: WebLogic Integration

The WebLogic Integration is used for fast access to a managed set of key-value pairs. The keys are of type string and the value contains XML data. For more information on source that uses the WebLogic Integration, see "Code Samples: Weblogic Integration" in the WebLogic Integration Code Library, available on dev2dev, which is available at the following URL: http://dev2dev.bea.com/code/wli.jsp.

Using the WebLogic Integration in your business process flow you can retrieve XML metadata from the XML MetaData Cache. The WebLogic Integration Administration Console manages the entries in the cache (add, delete, update). Alternatively, a custom application (such as a NetUI application) can be written to manage the cache. For more information, see Sharing Cache Data Within a Cluster.

The WebLogic Integration is intended to be used in a read-mostly environment. The XML MetaData Cache should only be used for configuration metadata. It is used to cache runtime xml data. Updating cache entries is expensive, as all cache entries in a cluster must be updated, where as read operations are always in-memory operations. The size of an XML value in the cache should typically be less than 100k bytes. Larger sizes will work, but with an increasing cost of updates. The XML MetaData Cache is a global, domain-wide cache. Data from the cache is made available on a permanent basis through file-based storage.

Figure 18-1 describes the XML MetaData Cache and WebLogic Integration implementation.

Figure 18-1 WebLogic Integration Implementation Overview

WebLogic Integration Implementation Overview

Sharing Cache Data Within a Cluster

You can add XML metadata to the cache only through the node on which the Administration Server is running. The Administration Server receives the input, and stores the key and the associated XML metadata in a file, in the following format:

XMLMetatadaCache_<keyname>_.xml

For each XML document that is added to the cache, a new XML MetaData Cache file is created. Once the file is created, the newly added XML document is propagated to all the nodes within the cluster. This ensures that the data is immediately available to any requesting node.

When using the XML MetaData Cache Control in a cluster, if a server on the cluster is restarted and a value changes while the server is offline, the server will receive the change notification when it comes online again.

Note: You cannot modify the XML MetaData Cache when the Administration Server is down.

Figure 18-2 describes how data is shared within a cluster.

Figure 18-2 Sharing Data Within a Cluster

Creating an WebLogic Integration in WebLogic Integration

You can create a new WebLogic Integration and add it to your business process. To define a new WebLogic Integration:

  1. In the Package Explorer pane, double-click the business process (Process.java file) to which you want to add the XML MetaData Cache control. The business process is displayed in the Design View.
  2. Click Sharing Data Within a Cluster on the Data Palette and from the drop-down list choose Integration Controls to display the list of controls used for integrating applications.
Note: If the Data Palette view is not visible in BEA Workshop for WebLogic Platform, click
WindowArrow symbolShowArrow symbolViewArrow symbolData Palette from the menu bar.
  1. Select XML MetaData Cache.
  2. The Insert Control: XML MetaData Cache dialog box appears.

  3. In the Insert Control: XML MetaData Cache dialog box enter the following details:
    • In the Field Name, type the variable name used to access the new XML MetaData Cache control instance from your business process. The name you enter must be a valid Java identifier.
    • In the Insertion point: from the drop-down list select the point where you want the field name to be inserted in the process file.
    • To make this a control factory select the Make this a control factory that can create multiple instances at runtime check box, otherwise clear the check box. For more information, see Control Factories: Managing Collections of Controls
    • Click Finish.

Understanding the WebLogic Integration Get Method

The WebLogic Integration includes the following method:

XmlObject get(String key)

Using this method, the get command uses the key of type String to access the XML Metadata in the cache. For more information on how to use this method, see Using the WebLogic Integration In a Business Process.

You can get a document from the cache only if you previously added it to the cache using the Administration Console. For more information on adding an XML document to the cache, see XML MetaData Cache in Managing WebLogic Integration Solutions, available at http://download.oracle.com/docs/cd/E13214_01/wli/docs92/manage/index.html.

Using the WebLogic Integration In a Business Process

Once created, you can use the new WebLogic Integration in a business process.

The business process usually starts with a Client Request node. This node represents a request made by a client to the process. In this case, the client invokes the get(String key) method on the process to get an XML metadata key from the cache.

To set up your business process to get XML metadata from the cache, do the following:

To Prepare the Client Node
  1. Open the Client Request node. In the General Settings tab, enter NewXMLMetadata in the Method Name field.
  2. Click Add, then select String from the Java datatype list. Enter Key1 as the variable in the Name field, then click OK to add your selection to the Client Request node. This indicates to the client that the control expects the client to send and receive a value of type string. The String represents the datatype used to define the key with which the XML metadata is associated.
  3. In the Receive Data tab, select a string as the variable that you want to assign to the tab of the Client Request node. The variable type is pre-defined, based on the parameters to which you are assigning the variable. The string represents the datatype used to define the value of the key, which is the core aspect of the object.
  4. Close the Client Request node. You can now add a get (String key) node to your business process.
To Get an XML metadata Document

You can use the following property to get an XML metadata document using the WebLogic Integration:

xmlObject get(String key)

The control uses this property to get a specific key from the XML MetaData Cache.

To get a key using the WebLogic Integration in a business process, perform the following steps:

  1. Drag the XmlObject get(String) method from the Data Palette and drop it below the Client Request node in your business process.
  2. Double-click the get node to display the General Settings tab of the Node Builder.
  3. Confirm that MyWebLogic Integration is displayed in the Control field and that the following method is selected in the Method field:
  4. get(String key)
  5. Open the Send Data tab. In the Select variables to assign drop-down list, select Key1(String).
  6. Open the Receive Data tab. In the Select variables to assign list, create a new variable called XML_1. The XMLObject datatype is selected by default. This step completes the get request for the XML metadata.
  7. Close the window.

The following code sample reflects the configuration of the add (String key) node.

public void get_metadataGet() throws Exception
{
//#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// input transform
// return method call
this.XML_1 = get_metadata.get(this.Key_1);
// output transform
// output assignments
//#END: CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
}

Example: WebLogic Integration

The following scenario describes how the XML MetaData Cache is deployed by business processes in a workflow.

The following elements are involved:

The Seller puts up goods for sale on the auction client and the buyer bids for the goods. When the bid is approved, the Seller requires the Buyer's details to proceed with the sale. Communication between the various elements of the workflow is handled by the Router process.

When the Buyer's bid is approved, the following scenario takes place:

  1. The Seller sends a request to the auction client for the Buyer's metadata. This metadata can include information such as the buyer's name, address, telephone number and so on.
  2. The Router examines the request and, based on the content of the request, pings the Buyer process for the required metadata.
  3. The buyer's information is contained in an XML document, present in the global XML MetaData Cache. The Router sends a request to the Buyer for the relevant key.
  4. The Router retrieves the key from the Buyer and uses the WebLogic Integration to perform a get request for the required metadata. The retrieved XML metadata is returned to the client. In this event, the Router process adds an WebLogic Integration, and uses the get (String key) method to retrieve the Buyer's XML metadata. The WebLogic Integration, is in effect, added to the Router process. This allows for smooth data retrieval.
Note: To enable successful transfer of information, the Buyer's metadata has to be present in the cache, before the Router JPD is deployed.

Using MBean APIs to Manage an XML MetaData Cache

You can use the Configuration MBean APIs to create your own cache, and to add, get, and delete data from the cache.

Retrieving the Singleton XMLCacheMBean

Use the following code to retrieve the singleton XMLCacheMBean:

Context ctx = new InitialContext();
MBeanHome home = (MBeanHome) ctx.lookup(MBeanHome.LOCAL_JNDI_NAME); (XMLCacheMBean) xmlCacheMBean = home.getMBean(XMLCacheMBean.SINGLETON_MBEAN_NAME, XMLCacheMBean.MBEAN_TYPE);
String key = "key1";

Using the Configuration MBean API

The Configuration MBean API provides the following methods to add an entry to, or to get or delete an entry from the XML MetaData Cache:

public XmlObject xmlObj = XmlObject.Factory.parse(new File(YourXmlFile)) //create an xmlObject

Use this method to create an XMLobject.

public xmlCacheMBean.add(key, xmlObj);

Use this method to add a key to the XML MetaData Cache.

public XmlObject xmlObject_get = xmlCacheMBean.get(key);

Use this method to get a key from the XML MetaData Cache.

public XmlObject newxmlObj = ..... //create another xmlObject

Use this method to create a new XMLObject.

public xmlCacheMBean.update(key,newxmlObj);

Use this method to update an XML MetaData Cache.

public xmlCacheMBean.delete(key);

Use this method to delete a key from the XML MetaData Cache.

public boolean keyExists = xmlCacheMBean.keyExists(key);

Use this method to find out if a particular key exists within the XML MetaData Cache.

public String[] allKeys = xmlCacheMBean.getAllKeys();

Use this method to get a list of all keys within the XML MetaData Cache.

  Back to Top       Previous  Next