Configuring a local in-memory ObjectGrid

A local in-memory eXtreme Scale configuration can be created by using an ObjectGrid descriptor XML file or eXtreme Scale APIs.

About this task

A simple XML example follows: the companyGrid.xml file. The first few lines of the file include the required header for each ObjectGrid XML file. The file defines the CompanyGrid ObjectGrid with Customer, Item, OrderLine, and Order BackingMaps. A deployment policy XML file is passed to an eXtreme Scale container during startup.

companyGrid.xml file
<?xml version="1.0" encoding="UTF-8"?>
<objectGridConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://ibm.com/ws/objectgrid/config ../objectGrid.xsd"
	xmlns="http://ibm.com/ws/objectgrid/config">

	<objectGrids>
		<objectGrid name="CompanyGrid">
			<backingMap name="Customer" />
			<backingMap name="Item" />
			<backingMap name="OrderLine" />
			<backingMap name="Order" />
		</objectGrid>
	</objectGrids>

</objectGridConfig>
Pass the XML file to one of the createObjectGrid methods in the ObjectGridManager interface. The following code sample validates the companyGrid.xml file against the XML schema, and creates the CompanyGrid ObjectGrid. The newly created ObjectGrid instance is not cached.
ObjectGridManager objectGridManager = ObjectGridManagerFactory.getObjectGridManager();
ObjectGrid companyGrid = objectGridManager.createObjectGrid("CompanyGrid", 
	new URL("file:etc/test/companyGrid.xml"), true, false);
As an alternative to using XML, ObjectGrid objects can be created programmatically. The following code sample can be used in place of the previous XML and code.
ObjectGridManager objectGridManager = ObjectGridManagerFactory.getObjectGridManager();
ObjectGrid companyGrid = objectGridManager.createObjectGrid ("CompanyGrid", false);
BackingMap customerMap= companyGrid.defineMap("Customer");
BackingMap itemMap= companyGrid.defineMap("Item");
BackingMap orderLineMap= companyGrid.defineMap("OrderLine");
BackingMap orderMap = companyGrid.defineMap("Order");
eXtreme Scale has many customizable plug-ins and attributes. For a complete description of the ObjectGrid XML file, see the eXtreme Scale configuration reference.