![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Note: | The XML MetaData Cache is managed using the Oracle WebLogic Integration Administration Console or the MBean API, which allows users to create their own NetUI based consoles. This control can be used to retrieve XML metadata that is present in the XML MetaData Cache. |
The XML MetaData Cache Control 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 WebLogic Integration Sample Code.
Using the XML MetaData Cache Control in your business process flow you can retrieve XML metadata from the XML MetaData Cache. The Oracle 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 XML MetaData Cache Control 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 21-1 describes the XML MetaData Cache and Oracle WebLogic Integration implementation.
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 21-2 describes how data is shared within a cluster.
You can create a new XML MetaData Cache Control and add it to your business process. To create a new XML MetaData Cache Control:
Note: | If the Data Palette view is not visible in Oracle Workshop for WebLogic, click Window > Show View > Data Palette from the menu bar. |
The Insert Control: XML MetaData Cache dialog box appears (see Figure 21-1).
Note: | Make this a control factory that can create multiple instances at runtime option is not available for XML MetaData Cache Control, and the option is disabled. |
The XML MetaData Cache Control includes the following method:
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 XML MetaData Cache Control 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 Cache.
Once created, you can use the new XML MetaData Cache Control 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:
get
method that you can use in your business process.get (String key)
node to your business process.You can use the following property to get an XML metadata document using the Oracle WebLogic Integration:
The control uses this property to get a specific key from the XML MetaData Cache.
To get a key using the Oracle WebLogic Integration in a business process, perform the following steps:
XmlObject get(String)
method from the Data Palette and drop it below the Client Request node in your business process.get(String key)
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. #//
}
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:
get (String key)
method to retrieve the Buyer’s XML metadata. The XML MetaData Cache Control, 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 business process is deployed. |
You can use the Configuration MBean APIs to create your own cache, and to add, get, and delete data from the cache.
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";
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
public xmlCacheMBean.add(key, xmlObj);
public XmlObject xmlObject_get = xmlCacheMBean.get(key);
public XmlObject newxmlObj = ..... //create another xmlObject
public xmlCacheMBean.update(key,newxmlObj);
public xmlCacheMBean.delete(key);
public boolean keyExists = xmlCacheMBean.keyExists(key);
public String[] allKeys = xmlCacheMBean.getAllKeys();
![]() ![]() ![]() |