Retrieving from Domain
The following Java™ and C# examples get existing
ObjectStore instances
by retrieving an ObjectStoreSet collection from the Domain object.
The
returned collection contains elements that represent each object store
that is defined in the Global Configuration Database (GCD).About this task
Java Example
// Instantiate object store from domain.
public static void instantiateObjectStoreFromDomain(
Connection conn,
String domainName) // Example: "Domain1"
{
// Get domain.
Domain domain = Factory.Domain.fetchInstance(
conn, domainName, null);
ObjectStoreSet osColl = domain.get_ObjectStores();
// Get each object store.
Iterator iterator = osColl.iterator();
while(iterator.hasNext())
{
// Get next object store.
ObjectStore objStore = (ObjectStore)iterator.next();
// Get the display name of the object store.
String objStoreName = objStore.get_DisplayName();
System.out.println("Object store name = " + objStoreName);
}
} C# Example
// Instantiate object store from domain.
public static void InstantiateObjectStoreFromDomain(
IConnection conn, String domainName) // Example: "Domain1"
{
// Get domain.
IDomain domain = Factory.Domain.FetchInstance(
conn, domainName, null);
IObjectStoreSet osColl = domain.ObjectStores;
// Get each object store.
foreach (IObjectStore objSstore in osColl)
{
// Get the display name of the object store.
String objStoreName = objStore.DisplayName;
Debug.WriteLine("Object store name = " + objStoreName);
}
}